Clean VMX step should always remove floppy.
When using the VMX builder its possible for the source machine to have a floppy configured which gets cloned to the new VM Packer spins up. When the new VM's Packer config doesn't have a floppy_files config entry, the Packer clean VMX step fails to remove the floppy disk from the new VM. This can cause build failures, for example with the vsphere post processor; generating errors like: * Post-processor failed: Failed: exit status 1 Error: File (/home/teamcity/tmp/buildTmp/packer941120499) could not be found. Opening the cloned VM's VMX file you can clearly see it has a floppy entry from the source machine's VMX file (exact same path) even though the Packer config contains no floppy_files entry.
This commit is contained in:
parent
a7122b3cf3
commit
7d9c252b3a
|
@ -32,7 +32,6 @@ func (s StepCleanVMX) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := state.GetOk("floppy_path"); ok {
|
|
||||||
// Delete the floppy0 entries so the floppy is no longer mounted
|
// Delete the floppy0 entries so the floppy is no longer mounted
|
||||||
ui.Message("Unmounting floppy from VMX...")
|
ui.Message("Unmounting floppy from VMX...")
|
||||||
for k, _ := range vmxData {
|
for k, _ := range vmxData {
|
||||||
|
@ -42,7 +41,6 @@ func (s StepCleanVMX) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmxData["floppy0.present"] = "FALSE"
|
vmxData["floppy0.present"] = "FALSE"
|
||||||
}
|
|
||||||
|
|
||||||
if isoPathRaw, ok := state.GetOk("iso_path"); ok {
|
if isoPathRaw, ok := state.GetOk("iso_path"); ok {
|
||||||
isoPath := isoPathRaw.(string)
|
isoPath := isoPathRaw.(string)
|
||||||
|
|
|
@ -39,7 +39,6 @@ func TestStepCleanVMX_floppyPath(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
state.Put("floppy_path", "foo")
|
|
||||||
state.Put("vmx_path", vmxPath)
|
state.Put("vmx_path", vmxPath)
|
||||||
|
|
||||||
// Test the run
|
// Test the run
|
||||||
|
|
Loading…
Reference in New Issue