Integrate code review comments.

This commit is contained in:
Steven Merrill 2013-07-02 01:12:57 -04:00
parent 29fa621907
commit 359ba01c6a
3 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,6 @@ 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"`
@ -115,9 +114,6 @@ 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)

View File

@ -6,7 +6,8 @@ import (
"github.com/mitchellh/packer/packer"
)
// This step compacts the virtual disks for the VM.
// This step compacts the virtual disk for the VM. If "compact_disk" is not
// true, it will immediately return.
//
// Uses:
// config *config
@ -18,12 +19,12 @@ import (
type stepCompactDisk struct{}
func (stepCompactDisk) Run(state map[string]interface{}) multistep.StepAction {
config := state["config"].(*config)
driver := state["driver"].(Driver)
ui := state["ui"].(packer.Ui)
full_disk_path := state["full_disk_path"].(string)
ui.Say("Compacting the disk image")
if err := driver.CompactDisk(config.FullDiskPath); err != nil {
if err := driver.CompactDisk(full_disk_path); err != nil {
err := fmt.Errorf("Error compacting disk: %s", err)
state["error"] = err
ui.Error(err.Error())

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"path/filepath"
)
// This step creates the virtual disks for the VM.
@ -23,12 +24,14 @@ func (stepCreateDisk) Run(state map[string]interface{}) multistep.StepAction {
ui := state["ui"].(packer.Ui)
ui.Say("Creating virtual machine disk")
if err := driver.CreateDisk(config.FullDiskPath, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
full_disk_path := filepath.Join(config.OutputDir, config.DiskName+".vmdk")
if err := driver.CreateDisk(full_disk_path, fmt.Sprintf("%dM", config.DiskSize)); err != nil {
err := fmt.Errorf("Error creating disk: %s", err)
state["error"] = err
ui.Error(err.Error())
return multistep.ActionHalt
}
state["full_disk_path"] = full_disk_path
return multistep.ActionContinue
}