Revert the shutdown command with new parameters as this will return proper exit codes. This will work in the same way as restart-computer -force when using ```shutdown /r /f /t 0```.

Note:The WinRM library does not return the exit code currently, this will be implemented on https://github.com/masterzen/winrm/pull/26
This commit is contained in:
Gonzalo Peci 2015-08-19 16:09:43 +12:00 committed by unknown
parent 70083fc869
commit 08359e409a
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import (
"github.com/mitchellh/packer/template/interpolate"
)
var DefaultRestartCommand = "powershell \"& {Restart-Computer -force }\""
var DefaultRestartCommand = "shutdown /r /f /t 0 /c \"packer restart\""
var DefaultRestartCheckCommand = winrm.Powershell(`echo "${env:COMPUTERNAME} restarted."`)
var retryableSleep = 5 * time.Second
var TryCheckReboot = "shutdown.exe -f -r -t 60"

View File

@ -35,7 +35,7 @@ func TestProvisionerPrepare_Defaults(t *testing.T) {
t.Errorf("unexpected remote path: %s", p.config.RestartTimeout)
}
if p.config.RestartCommand != "powershell \"& {Restart-Computer -force }\"" {
if p.config.RestartCommand != "shutdown /r /f /t 0 /c \"packer restart\"" {
t.Errorf("unexpected remote path: %s", p.config.RestartCommand)
}
}