Remove ISO from ide1 in stepCleanVMX

This commit is contained in:
Timothy Sutton 2013-07-19 20:46:26 -04:00
parent 16d102d055
commit 0c7efde103
1 changed files with 14 additions and 10 deletions

View File

@ -22,9 +22,6 @@ import (
type stepCleanVMX struct{} type stepCleanVMX struct{}
func (s stepCleanVMX) Run(state map[string]interface{}) multistep.StepAction { func (s stepCleanVMX) Run(state map[string]interface{}) multistep.StepAction {
if _, ok := state["floppy_path"]; !ok {
return multistep.ActionContinue
}
ui := state["ui"].(packer.Ui) ui := state["ui"].(packer.Ui)
vmxPath := state["vmx_path"].(string) vmxPath := state["vmx_path"].(string)
@ -35,6 +32,7 @@ func (s stepCleanVMX) Run(state map[string]interface{}) multistep.StepAction {
return multistep.ActionHalt return multistep.ActionHalt
} }
if _, ok := state["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.Say("Unmounting floppy from VMX...") ui.Say("Unmounting floppy from VMX...")
for k, _ := range vmxData { for k, _ := range vmxData {
@ -44,6 +42,12 @@ func (s stepCleanVMX) Run(state map[string]interface{}) multistep.StepAction {
} }
} }
vmxData["floppy0.present"] = "FALSE" vmxData["floppy0.present"] = "FALSE"
}
// Change the CD-ROM device back to auto-detect, ejecting the iso
ui.Say("Detatching ISO from CD-ROM device...")
vmxData["ide1:0.fileName"] = "auto detect"
vmxData["ide1:0.deviceType"] = "cdrom-raw"
// Rewrite the VMX // Rewrite the VMX
if err := WriteVMX(vmxPath, vmxData); err != nil { if err := WriteVMX(vmxPath, vmxData); err != nil {