From c9d0de593e289cca4f18ce6cc15fca476c681c35 Mon Sep 17 00:00:00 2001 From: Steven Merrill Date: Mon, 1 Jul 2013 22:22:00 -0400 Subject: [PATCH] Add a computed FullDiskPath config option. --- builder/vmware/builder.go | 4 ++++ builder/vmware/step_create_disk.go | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index d8a8f27b6..e064d5d4a 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -52,6 +52,7 @@ type config struct { PackerBuildName string `mapstructure:"packer_build_name"` PackerDebug bool `mapstructure:"packer_debug"` + FullDiskPath string `` RawBootWait string `mapstructure:"boot_wait"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"` @@ -114,6 +115,9 @@ func (b *Builder) Prepare(raws ...interface{}) error { b.config.ToolsUploadPath = "{{ .Flavor }}.iso" } + // Store the full path to the disk file. + b.config.FullDiskPath = filepath.Join(b.config.OutputDir, b.config.DiskName+".vmdk") + // Accumulate any errors var err error errs := make([]error, 0) diff --git a/builder/vmware/step_create_disk.go b/builder/vmware/step_create_disk.go index 7624224d0..5997bf998 100644 --- a/builder/vmware/step_create_disk.go +++ b/builder/vmware/step_create_disk.go @@ -24,8 +24,7 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction { ui := state["ui"].(packer.Ui) ui.Say("Creating virtual machine disk") - output := filepath.Join(config.OutputDir, config.DiskName+".vmdk") - if err := driver.CreateDisk(output, fmt.Sprintf("%dM", config.DiskSize)); err != nil { + if err := driver.CreateDisk(config.FullDiskPath, fmt.Sprintf("%dM", config.DiskSize)); err != nil { err := fmt.Errorf("Error creating disk: %s", err) state["error"] = err ui.Error(err.Error())