Commit ba3bae8a authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #1239 from StefanScherer/fix_skip_floppy_in_vmx_data_post_step

builde/vmware: skip adding floppy again in vmx_data_post step
parents 519adf85 de5c38e6
...@@ -18,6 +18,7 @@ import ( ...@@ -18,6 +18,7 @@ import (
// vmx_path string // vmx_path string
type StepConfigureVMX struct { type StepConfigureVMX struct {
CustomData map[string]string CustomData map[string]string
SkipFloppy bool
} }
func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction { func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
...@@ -56,6 +57,8 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction { ...@@ -56,6 +57,8 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
vmxData[k] = v vmxData[k] = v
} }
// Set a floppy disk, but only if we should
if ! s.SkipFloppy {
// Set a floppy disk if we have one // Set a floppy disk if we have one
if floppyPathRaw, ok := state.GetOk("floppy_path"); ok { if floppyPathRaw, ok := state.GetOk("floppy_path"); ok {
log.Println("Floppy path present, setting in VMX") log.Println("Floppy path present, setting in VMX")
...@@ -63,6 +66,7 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction { ...@@ -63,6 +66,7 @@ func (s *StepConfigureVMX) Run(state multistep.StateBag) multistep.StepAction {
vmxData["floppy0.filetype"] = "file" vmxData["floppy0.filetype"] = "file"
vmxData["floppy0.filename"] = floppyPathRaw.(string) vmxData["floppy0.filename"] = floppyPathRaw.(string)
} }
}
if err := WriteVMX(vmxPath, vmxData); err != nil { if err := WriteVMX(vmxPath, vmxData); err != nil {
err := fmt.Errorf("Error writing VMX file: %s", err) err := fmt.Errorf("Error writing VMX file: %s", err)
......
...@@ -369,6 +369,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -369,6 +369,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&vmwcommon.StepCleanFiles{}, &vmwcommon.StepCleanFiles{},
&vmwcommon.StepConfigureVMX{ &vmwcommon.StepConfigureVMX{
CustomData: b.config.VMXDataPost, CustomData: b.config.VMXDataPost,
SkipFloppy: true,
}, },
&vmwcommon.StepCleanVMX{}, &vmwcommon.StepCleanVMX{},
&vmwcommon.StepCompactDisk{ &vmwcommon.StepCompactDisk{
......
...@@ -96,6 +96,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -96,6 +96,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&vmwcommon.StepCleanFiles{}, &vmwcommon.StepCleanFiles{},
&vmwcommon.StepConfigureVMX{ &vmwcommon.StepConfigureVMX{
CustomData: b.config.VMXDataPost, CustomData: b.config.VMXDataPost,
SkipFloppy: true,
}, },
&vmwcommon.StepCleanVMX{}, &vmwcommon.StepCleanVMX{},
&vmwcommon.StepCompactDisk{ &vmwcommon.StepCompactDisk{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment