Merge pull request #4378 from DanHam/skip-export-vmware
Add option to skip export of installed VM for VMware ISO builder
This commit is contained in:
commit
98b0f018fa
|
@ -48,6 +48,7 @@ type Config struct {
|
|||
BootCommand []string `mapstructure:"boot_command"`
|
||||
KeepRegistered bool `mapstructure:"keep_registered"`
|
||||
SkipCompaction bool `mapstructure:"skip_compaction"`
|
||||
SkipExport bool `mapstructure:"skip_export"`
|
||||
VMXTemplatePath string `mapstructure:"vmx_template_path"`
|
||||
VMXDiskTemplatePath string `mapstructure:"vmx_disk_template_path"`
|
||||
|
||||
|
@ -302,6 +303,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
},
|
||||
&StepExport{
|
||||
Format: b.config.Format,
|
||||
SkipExport: b.config.SkipExport,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
type StepExport struct {
|
||||
Format string
|
||||
SkipExport bool
|
||||
}
|
||||
|
||||
func (s *StepExport) generateArgs(c *Config, outputPath string, hidePassword bool) []string {
|
||||
|
@ -35,6 +36,12 @@ func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction {
|
|||
c := state.Get("config").(*Config)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
// Skip export if requested
|
||||
if c.SkipExport {
|
||||
ui.Say("Skipping export of virtual machine...")
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
if c.RemoteType != "esx5" || s.Format == "" {
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
|
|
@ -230,6 +230,10 @@ builder.
|
|||
slightly larger. If you find this to be the case, you can disable compaction
|
||||
using this configuration value. Defaults to `false`.
|
||||
|
||||
- `skip_export` (boolean) - Defaults to false. When enabled Packer will skip
|
||||
export of the installed virtual machine. Only useful for some edge use
|
||||
cases.
|
||||
|
||||
- `keep_registered` (boolean) - Set this to `true` if you would like to keep
|
||||
the VM registered with the remote ESXi server. This is convenient if you
|
||||
use packer to provision VMs on ESXi and don't want to use ovftool to
|
||||
|
|
Loading…
Reference in New Issue