Add option to skip export of installed VM for VMware iso builder
This commit is contained in:
parent
377f451a9e
commit
c7e8d671a9
|
@ -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"`
|
||||
|
||||
|
@ -301,7 +302,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
RemoteType: b.config.RemoteType,
|
||||
},
|
||||
&StepExport{
|
||||
Format: b.config.Format,
|
||||
Format: b.config.Format,
|
||||
SkipExport: b.config.SkipExport,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ import (
|
|||
)
|
||||
|
||||
type StepExport struct {
|
||||
Format string
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue