Merge pull request #4339 from DanHam/gh-4131

Add option to skip export of installed VM for vbox ISO & OVF builders
pull/4386/head
Matthew Hooker 9 years ago committed by GitHub
commit a3da92dc97

@ -21,6 +21,7 @@ type StepExport struct {
OutputDir string
ExportOpts []string
SkipNatMapping bool
SkipExport bool
}
func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
@ -28,6 +29,12 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
vmName := state.Get("vmName").(string)
// Skip export if requested
if s.SkipExport {
ui.Say("Skipping export of virtual machine...")
return multistep.ActionContinue
}
// Wait a second to ensure VM is really shutdown.
log.Println("1 second timeout to ensure VM is really shutdown")
time.Sleep(1 * time.Second)

@ -39,16 +39,17 @@ 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"`
GuestAdditionsSHA256 string `mapstructure:"guest_additions_sha256"`
GuestAdditionsURL string `mapstructure:"guest_additions_url"`
GuestOSType string `mapstructure:"guest_os_type"`
HardDriveDiscard bool `mapstructure:"hard_drive_discard"`
HardDriveInterface string `mapstructure:"hard_drive_interface"`
HardDriveNonrotational bool `mapstructure:"hard_drive_nonrotational"`
HardDriveDiscard bool `mapstructure:"hard_drive_discard"`
ISOInterface string `mapstructure:"iso_interface"`
KeepRegistered bool `mapstructure:"keep_registered"`
SkipExport bool `mapstructure:"skip_export"`
VMName string `mapstructure:"vm_name"`
ctx interpolate.Context
@ -268,6 +269,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
OutputDir: b.config.OutputDir,
ExportOpts: b.config.ExportOpts.ExportOpts,
SkipNatMapping: b.config.SSHSkipNatMapping,
SkipExport: b.config.SkipExport,
},
}

@ -142,6 +142,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
OutputDir: b.config.OutputDir,
ExportOpts: b.config.ExportOpts.ExportOpts,
SkipNatMapping: b.config.SSHSkipNatMapping,
SkipExport: b.config.SkipExport,
},
}

@ -27,17 +27,18 @@ type Config struct {
vboxcommon.VBoxVersionConfig `mapstructure:",squash"`
BootCommand []string `mapstructure:"boot_command"`
SourcePath string `mapstructure:"source_path"`
Checksum string `mapstructure:"checksum"`
ChecksumType string `mapstructure:"checksum_type"`
TargetPath string `mapstructure:"target_path"`
GuestAdditionsMode string `mapstructure:"guest_additions_mode"`
GuestAdditionsPath string `mapstructure:"guest_additions_path"`
GuestAdditionsURL string `mapstructure:"guest_additions_url"`
GuestAdditionsSHA256 string `mapstructure:"guest_additions_sha256"`
VMName string `mapstructure:"vm_name"`
ImportOpts string `mapstructure:"import_opts"`
GuestAdditionsURL string `mapstructure:"guest_additions_url"`
ImportFlags []string `mapstructure:"import_flags"`
ImportOpts string `mapstructure:"import_opts"`
SourcePath string `mapstructure:"source_path"`
TargetPath string `mapstructure:"target_path"`
VMName string `mapstructure:"vm_name"`
SkipExport bool `mapstructure:"skip_export"`
ctx interpolate.Context
}

@ -271,6 +271,10 @@ builder.
doesn't shut down in this time, it is an error. By default, the timeout is
`5m`, or five minutes.
- `skip_export` (boolean) - Defaults to `false`. When enabled Packer will
skip export of the installed virtual machine. Only useful for some edge
use cases.
- `ssh_host_port_min` and `ssh_host_port_max` (integer) - The minimum and
maximum port to use for the SSH port on the host machine which is forwarded
to the SSH port on the guest machine. Because Packer often runs in parallel,

@ -229,6 +229,10 @@ builder.
doesn't shut down in this time, it is an error. By default, the timeout is
"5m", or five minutes.
- `skip_export` (boolean) - Defaults to `false`. When enabled Packer will
skip export of the installed virtual machine. Only useful for some edge
use cases.
- `ssh_host_port_min` and `ssh_host_port_max` (integer) - The minimum and
maximum port to use for the SSH port on the host machine which is forwarded
to the SSH port on the guest machine. Because Packer often runs in parallel,

Loading…
Cancel
Save