Commit 5f183026 authored by Eric Richardson's avatar Eric Richardson Committed by Shawn Neal

Fix vmware compact_disk step when there are no additional disks

parent 7dfb837d
...@@ -37,8 +37,8 @@ func (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction { ...@@ -37,8 +37,8 @@ func (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt return multistep.ActionHalt
} }
moreDisks := state.Get("additional_disk_paths").([]string) if state.Get("additional_disk_paths") != nil {
if len(moreDisks) > 0 { if moreDisks := state.Get("additional_disk_paths").([]string); len(moreDisks) > 0 {
for i, path := range moreDisks { for i, path := range moreDisks {
ui.Say(fmt.Sprintf("Compacting additional disk image %d",i+1)) ui.Say(fmt.Sprintf("Compacting additional disk image %d",i+1))
if err := driver.CompactDisk(path); err != nil { if err := driver.CompactDisk(path); err != nil {
...@@ -46,7 +46,7 @@ func (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction { ...@@ -46,7 +46,7 @@ func (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionHalt return multistep.ActionHalt
} }
} }
}
} }
return multistep.ActionContinue return multistep.ActionContinue
......
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