From 52fb77a8835fed0f2a040a3c464e9f12a5f6dfe9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 7 Nov 2013 22:06:11 -0800 Subject: [PATCH] builder/vmware: case-insensitive VMX creation [GH-608] --- CHANGELOG.md | 4 ++++ builder/vmware/ssh.go | 2 +- builder/vmware/step_clean_vmx.go | 2 +- builder/vmware/step_create_vmx.go | 8 +++++--- builder/vmware/vmx.go | 3 ++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0df0c7a8..a974e6476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ IMPROVEMENTS: * builder/amazon/all: Can now specify a list of multiple security group IDs to apply. [GH-499] +BUG FIXES: + +* builder/vmware: VMX modifications are now case-insensitive. [GH-608] + ## 0.3.11 (November 4, 2013) FEATURES: diff --git a/builder/vmware/ssh.go b/builder/vmware/ssh.go index 121d79709..0b499db29 100644 --- a/builder/vmware/ssh.go +++ b/builder/vmware/ssh.go @@ -33,7 +33,7 @@ func sshAddress(state multistep.StateBag) (string, error) { var ok bool macAddress := "" if macAddress, ok = vmxData["ethernet0.address"]; !ok || macAddress == "" { - if macAddress, ok = vmxData["ethernet0.generatedAddress"]; !ok || macAddress == "" { + if macAddress, ok = vmxData["ethernet0.generatedaddress"]; !ok || macAddress == "" { return "", errors.New("couldn't find MAC address in VMX") } } diff --git a/builder/vmware/step_clean_vmx.go b/builder/vmware/step_clean_vmx.go index 669d3b2bb..c8a66c5e0 100644 --- a/builder/vmware/step_clean_vmx.go +++ b/builder/vmware/step_clean_vmx.go @@ -60,7 +60,7 @@ func (s stepCleanVMX) Run(state multistep.StateBag) multistep.StepAction { if filename == isoPath { // Change the CD-ROM device back to auto-detect to eject vmxData[filenameKey] = "auto detect" - vmxData[match+".deviceType"] = "cdrom-raw" + vmxData[match+".devicetype"] = "cdrom-raw" } } } diff --git a/builder/vmware/step_create_vmx.go b/builder/vmware/step_create_vmx.go index bfff50b6e..6039b3dfc 100644 --- a/builder/vmware/step_create_vmx.go +++ b/builder/vmware/step_create_vmx.go @@ -8,6 +8,7 @@ import ( "log" "os" "path/filepath" + "strings" ) type vmxTemplateData struct { @@ -79,6 +80,7 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction { log.Println("Setting custom VMX data...") for k, v := range config.VMXData { log.Printf("Setting VMX: '%s' = '%s'", k, v) + k = strings.ToLower(k) vmxData[k] = v } } @@ -86,12 +88,12 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction { if floppyPathRaw, ok := state.GetOk("floppy_path"); ok { log.Println("Floppy path present, setting in VMX") vmxData["floppy0.present"] = "TRUE" - vmxData["floppy0.fileType"] = "file" - vmxData["floppy0.fileName"] = floppyPathRaw.(string) + vmxData["floppy0.filetype"] = "file" + vmxData["floppy0.filename"] = floppyPathRaw.(string) } // Set this so that no dialogs ever appear from Packer. - vmxData["msg.autoAnswer"] = "true" + vmxData["msg.autoanswer"] = "true" vmxDir := config.OutputDir if config.RemoteType != "" { diff --git a/builder/vmware/vmx.go b/builder/vmware/vmx.go index ffd5ac07a..ff60d5477 100644 --- a/builder/vmware/vmx.go +++ b/builder/vmware/vmx.go @@ -24,7 +24,8 @@ func ParseVMX(contents string) map[string]string { continue } - results[matches[1]] = matches[2] + key := strings.ToLower(matches[1]) + results[key] = matches[2] } return results