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"`
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -334,7 +338,7 @@ by the proper key:
|
|||
|
||||
- `<leftAltOn>` `<rightAltOn>` - Simulates pressing and holding the alt key.
|
||||
|
||||
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||
- `<leftCtrlOn>` `<rightCtrlOn>` - Simulates pressing and holding the ctrl key.
|
||||
|
||||
- `<leftShiftOn>` `<rightShiftOn>` - Simulates pressing and holding the shift key.
|
||||
|
||||
|
@ -348,9 +352,9 @@ by the proper key:
|
|||
sending any additional keys. This is useful if you have to generally wait
|
||||
for the UI to update before typing more.
|
||||
|
||||
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them,
|
||||
otherwise they will be held down until the machine reboots. Use lowercase
|
||||
characters as well inside modifiers.
|
||||
When using modifier keys `ctrl`, `alt`, `shift` ensure that you release them,
|
||||
otherwise they will be held down until the machine reboots. Use lowercase
|
||||
characters as well inside modifiers.
|
||||
|
||||
For example: to simulate ctrl+c use `<leftCtrlOn>c<leftCtrlOff>`.
|
||||
|
||||
|
|
Loading…
Reference in New Issue