Fixed the regex in common/step_clean_vmx.go for the VMware builder to also support removal of sata-based cdrom devices. Also added a comment in iso/step_create_vmx.go that links both pieces of related code.

This commit is contained in:
Ali Rizvi-Santiago 2018-04-26 14:01:58 -05:00
parent 6e2f06ef49
commit 5d8b476a7f
2 changed files with 3 additions and 1 deletions

View File

@ -47,7 +47,7 @@ func (s StepCleanVMX) Run(_ context.Context, state multistep.StateBag) multistep
}
vmxData["floppy0.present"] = "FALSE"
devRe := regexp.MustCompile(`^ide\d:\d\.`)
devRe := regexp.MustCompile(`^(ide|sata)\d:\d\.`)
for k, v := range vmxData {
ide := devRe.FindString(k)
if ide == "" || v != "cdrom-image" {

View File

@ -396,6 +396,8 @@ func (s *stepCreateVMX) Run(_ context.Context, state multistep.StateBag) multist
/// Use the disk adapter type that the user specified to tweak the .vmx
// Also sync the cdrom adapter type according to what's common for that disk type.
// XXX: If the cdrom type is modified, make sure to update common/step_clean_vmx.go
// so that it will regex the correct cdrom device for removal.
diskAdapterType := strings.ToLower(config.DiskAdapterType)
switch diskAdapterType {
case "ide":