Add VMName to the vmx mods.

This commit is contained in:
Alexander Laamanen 2017-02-03 09:00:30 +02:00 committed by Megan Marsh
parent 7b5943160b
commit 2d00dc6756
3 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import (
type StepConfigureVMX struct {
CustomData map[string]string
SkipFloppy bool
VMName string
}
func (s *StepConfigureVMX) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
@ -47,6 +48,7 @@ func (s *StepConfigureVMX) Run(_ context.Context, state multistep.StateBag) mult
// Create a new UUID for this VM, since it is a new VM
vmxData["uuid.action"] = "create"
vmxData["displayname"] = s.VMName
// Delete any generated addresses since we want to regenerate
// them. Conflicting MAC addresses is a bad time.
addrRegex := regexp.MustCompile(`(?i)^ethernet\d+\.generatedAddress`)

View File

@ -316,6 +316,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&stepCreateVMX{},
&vmwcommon.StepConfigureVMX{
CustomData: b.config.VMXData,
VMName: b.config.VMName,
},
&vmwcommon.StepSuppressMessages{},
&common.StepHTTPServer{

View File

@ -73,6 +73,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
},
&vmwcommon.StepConfigureVMX{
CustomData: b.config.VMXData,
VMName: b.config.VMName,
},
&vmwcommon.StepSuppressMessages{},
&common.StepHTTPServer{