diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index ac8b574d5..95028d744 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -177,6 +177,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact { rand.Seed(time.Now().UTC().UnixNano()) steps := []multistep.Step{ + &stepDownloadISO{}, &stepPrepareOutputDir{}, &stepCreateDisk{}, &stepCreateVMX{}, diff --git a/builder/vmware/step_create_vmx.go b/builder/vmware/step_create_vmx.go index 313111126..f8ff37665 100644 --- a/builder/vmware/step_create_vmx.go +++ b/builder/vmware/step_create_vmx.go @@ -21,6 +21,7 @@ type vmxTemplateData struct { // // Uses: // config *config +// iso_path string // ui packer.Ui // // Produces: @@ -29,6 +30,7 @@ type stepCreateVMX struct{} func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction { config := state["config"].(*config) + isoPath := state["iso_path"].(string) ui := state["ui"].(packer.Ui) ui.Say("Building and writing VMX file") @@ -37,7 +39,7 @@ func (stepCreateVMX) Run(state map[string]interface{}) multistep.StepAction { config.VMName, config.GuestOSType, config.DiskName, - config.ISOUrl, + isoPath, } var buf bytes.Buffer diff --git a/builder/vmware/step_download_iso.go b/builder/vmware/step_download_iso.go new file mode 100644 index 000000000..39fa728c9 --- /dev/null +++ b/builder/vmware/step_download_iso.go @@ -0,0 +1,28 @@ +package vmware + +import ( + "github.com/mitchellh/multistep" + "log" +) + +// This step downloads the ISO specified. +// +// Uses: +// config *config +// ui packer.Ui +// +// Produces: +// iso_path string +type stepDownloadISO struct{} + +func (stepDownloadISO) Run(state map[string]interface{}) multistep.StepAction { + config := state["config"].(*config) + + log.Printf("Acquiring lock to download the ISO.") + + state["iso_path"] = config.ISOUrl + + return multistep.ActionContinue +} + +func (stepDownloadISO) Cleanup(map[string]interface{}) {}