builder/virtualbox: shutdown messages go to Ui
This commit is contained in:
parent
3641c1a708
commit
479855a4f1
|
@ -34,16 +34,13 @@ func (s *stepShutdown) Run(state map[string]interface{}) multistep.StepAction {
|
||||||
ui.Say("Gracefully halting virtual machine...")
|
ui.Say("Gracefully halting virtual machine...")
|
||||||
log.Printf("Executing shutdown command: %s", config.ShutdownCommand)
|
log.Printf("Executing shutdown command: %s", config.ShutdownCommand)
|
||||||
cmd := &packer.RemoteCmd{Command: config.ShutdownCommand}
|
cmd := &packer.RemoteCmd{Command: config.ShutdownCommand}
|
||||||
if err := comm.Start(cmd); err != nil {
|
if err := cmd.StartWithUi(comm, ui); err != nil {
|
||||||
err := fmt.Errorf("Failed to send shutdown command: %s", err)
|
err := fmt.Errorf("Failed to send shutdown command: %s", err)
|
||||||
state["error"] = err
|
state["error"] = err
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the command to run
|
|
||||||
cmd.Wait()
|
|
||||||
|
|
||||||
// Wait for the machine to actually shut down
|
// Wait for the machine to actually shut down
|
||||||
log.Printf("Waiting max %s for shutdown to complete", config.shutdownTimeout)
|
log.Printf("Waiting max %s for shutdown to complete", config.shutdownTimeout)
|
||||||
shutdownTimer := time.After(config.shutdownTimeout)
|
shutdownTimer := time.After(config.shutdownTimeout)
|
||||||
|
|
Loading…
Reference in New Issue