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
pull/2568/head
Gonzalo Peci 11 years ago committed by unknown
parent 70083fc869
commit 08359e409a

@ -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"

@ -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)
}
}

Loading…
Cancel
Save