added functionality like vm

This commit is contained in:
Ed Overton 2016-10-03 15:11:21 -04:00
parent c3a0182f65
commit 1adb0a5fc3
2 changed files with 9 additions and 0 deletions

View File

@ -39,6 +39,7 @@ type Config struct {
BootCommand []string `mapstructure:"boot_command"`
DiskSize uint `mapstructure:"disk_size"`
KeepRegistered bool `mapstructure:"keep_registered"`
GuestAdditionsMode string `mapstructure:"guest_additions_mode"`
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
GuestAdditionsURL string `mapstructure:"guest_additions_url"`

View File

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