Commit c9d0de59 authored by Steven Merrill's avatar Steven Merrill

Add a computed FullDiskPath config option.

parent 67df7b77
...@@ -52,6 +52,7 @@ type config struct { ...@@ -52,6 +52,7 @@ type config struct {
PackerBuildName string `mapstructure:"packer_build_name"` PackerBuildName string `mapstructure:"packer_build_name"`
PackerDebug bool `mapstructure:"packer_debug"` PackerDebug bool `mapstructure:"packer_debug"`
FullDiskPath string ``
RawBootWait string `mapstructure:"boot_wait"` RawBootWait string `mapstructure:"boot_wait"`
RawShutdownTimeout string `mapstructure:"shutdown_timeout"` RawShutdownTimeout string `mapstructure:"shutdown_timeout"`
...@@ -114,6 +115,9 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -114,6 +115,9 @@ func (b *Builder) Prepare(raws ...interface{}) error {
b.config.ToolsUploadPath = "{{ .Flavor }}.iso" 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 // Accumulate any errors
var err error var err error
errs := make([]error, 0) errs := make([]error, 0)
......
...@@ -24,8 +24,7 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction { ...@@ -24,8 +24,7 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction {
ui := state["ui"].(packer.Ui) ui := state["ui"].(packer.Ui)
ui.Say("Creating virtual machine disk") ui.Say("Creating virtual machine disk")
output := filepath.Join(config.OutputDir, config.DiskName+".vmdk") if err := driver.CreateDisk(config.FullDiskPath, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
if err := driver.CreateDisk(output, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
err := fmt.Errorf("Error creating disk: %s", err) err := fmt.Errorf("Error creating disk: %s", err)
state["error"] = err state["error"] = err
ui.Error(err.Error()) ui.Error(err.Error())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment