Updated StepCreateVMX to add the CDROM device that packer uses to the "temporaryDevices" statebag so that StepCleanVMX can unmount its ISO later.

This commit is contained in:
Ali Rizvi-Santiago 2018-12-03 17:46:02 -06:00
parent 3512c3c5ea
commit e0d3861e81
1 changed files with 7 additions and 0 deletions

View File

@ -243,6 +243,13 @@ func (s *stepCreateVMX) Run(_ context.Context, state multistep.StateBag) multist
return multistep.ActionHalt
}
/// Now that we figured out the CDROM device to add, store it
/// to the list of temporary build devices in our statebag
tmpBuildDevices := state.Get("temporaryDevices").([]string)
tmpCdromDevice := fmt.Sprintf("%s0:%s", templateData.CDROMType, templateData.CDROMType_PrimarySecondary)
tmpBuildDevices = append(tmpBuildDevices, tmpCdromDevice)
state.Put("temporaryDevices", tmpBuildDevices)
/// Assign the network adapter type into the template if one was specified.
network_adapter := strings.ToLower(config.HWConfig.NetworkAdapterType)
if network_adapter != "" {