builder/vmware: case-insensitive VMX creation [GH-608]

This commit is contained in:
Mitchell Hashimoto 2013-11-07 22:06:11 -08:00
parent d138e6a925
commit 52fb77a883
5 changed files with 13 additions and 6 deletions

View File

@ -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:

View File

@ -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")
}
}

View File

@ -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"
}
}
}

View File

@ -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 != "" {

View File

@ -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