added functionality like vm
This commit is contained in:
parent
c3a0182f65
commit
1adb0a5fc3
|
@ -39,6 +39,7 @@ type Config struct {
|
||||||
|
|
||||||
BootCommand []string `mapstructure:"boot_command"`
|
BootCommand []string `mapstructure:"boot_command"`
|
||||||
DiskSize uint `mapstructure:"disk_size"`
|
DiskSize uint `mapstructure:"disk_size"`
|
||||||
|
KeepRegistered bool `mapstructure:"keep_registered"`
|
||||||
GuestAdditionsMode string `mapstructure:"guest_additions_mode"`
|
GuestAdditionsMode string `mapstructure:"guest_additions_mode"`
|
||||||
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
|
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
|
||||||
GuestAdditionsURL string `mapstructure:"guest_additions_url"`
|
GuestAdditionsURL string `mapstructure:"guest_additions_url"`
|
||||||
|
|
|
@ -64,6 +64,14 @@ func (s *stepCreateVM) Cleanup(state multistep.StateBag) {
|
||||||
|
|
||||||
driver := state.Get("driver").(vboxcommon.Driver)
|
driver := state.Get("driver").(vboxcommon.Driver)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
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...")
|
ui.Say("Unregistering and deleting virtual machine...")
|
||||||
var err error = nil
|
var err error = nil
|
||||||
|
|
Loading…
Reference in New Issue