|
|
|
|
@ -64,6 +64,14 @@ func (s *stepCreateVM) Cleanup(state multistep.StateBag) {
|
|
|
|
|
|
|
|
|
|
driver := state.Get("driver").(vboxcommon.Driver)
|
|
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
|
config := state.Get("config").(*Config)
|
|
|
|
|
|
|
|
|
|
_, cancelled := state.GetOk(multistep.StateCancelled)
|
|
|
|
|
_, halted := state.GetOk(multistep.StateHalted)
|
|
|
|
|
if (config.KeepRegistered) && (!cancelled && !halted) {
|
|
|
|
|
ui.Say("Keeping virtual machine registered with VirtualBox host (keep_registered = true)")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.Say("Unregistering and deleting virtual machine...")
|
|
|
|
|
var err error = nil
|
|
|
|
|
|