Commit 0f376457 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox: only power off the machine if it isrunning

parent bdd60fe9
......@@ -48,7 +48,10 @@ func (s *stepRun) Cleanup(state map[string]interface{}) {
driver := state["driver"].(Driver)
ui := state["ui"].(packer.Ui)
if running, _ := driver.IsRunning(s.vmName); running {
if err := driver.VBoxManage("controlvm", s.vmName, "poweroff"); err != nil {
ui.Error(fmt.Sprintf("Error shutting down VM: %s", err))
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment