Formatting cleanups from `go fmt`

This commit is contained in:
Eric Richardson 2014-03-04 15:00:24 -05:00 committed by Shawn Neal
parent fab9ca9cdb
commit 7dfb837ddb
2 changed files with 16 additions and 16 deletions

View File

@ -34,26 +34,26 @@ func (stepCreateDisk) Run(state multistep.StateBag) multistep.StepAction {
}
state.Put("full_disk_path", full_disk_path)
if len(config.AdditionalDiskSize) > 0 {
// stash the disk paths we create
additional_paths := make([]string,len(config.AdditionalDiskSize))
additional_paths := make([]string, len(config.AdditionalDiskSize))
ui.Say("Creating additional hard drives...")
for i, additionalsize := range config.AdditionalDiskSize {
additionalpath := filepath.Join(config.OutputDir, fmt.Sprintf("%s-%d.vmdk",config.DiskName,i+1))
additionalpath := filepath.Join(config.OutputDir, fmt.Sprintf("%s-%d.vmdk", config.DiskName, i+1))
size := fmt.Sprintf("%dM", uint64(additionalsize))
if err := driver.CreateDisk(additionalpath, size, config.DiskTypeId); err != nil {
err := fmt.Errorf("Error creating additional disk: %s", err)
state.Put("error",err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
additional_paths[i] = additionalpath
}
state.Put("additional_disk_paths", additional_paths)
}

View File

@ -21,8 +21,8 @@ type vmxTemplateData struct {
}
type additionalDiskTemplateData struct {
DiskNumber int
DiskName string
DiskNumber int
DiskName string
}
// This step creates the VMX file for the VM.
@ -75,22 +75,22 @@ func (s *stepCreateVMX) Run(state multistep.StateBag) multistep.StepAction {
vmxTemplate = string(rawBytes)
}
if len(config.AdditionalDiskSize) > 0 {
for i, _ := range config.AdditionalDiskSize {
data := &additionalDiskTemplateData{
DiskNumber: i+1,
DiskName: config.DiskName,
DiskNumber: i + 1,
DiskName: config.DiskName,
}
diskTemplate, err := config.tpl.Process(DefaultAdditionalDiskTemplate,data)
diskTemplate, err := config.tpl.Process(DefaultAdditionalDiskTemplate, data)
if err != nil {
err := fmt.Errorf("Error preparing VMX template for additional disk: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
vmxTemplate += diskTemplate
}
}