Fix vmware compact_disk step when there are no additional disks
This commit is contained in:
parent
7dfb837ddb
commit
5f183026b3
|
@ -37,16 +37,16 @@ func (s StepCompactDisk) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
moreDisks := state.Get("additional_disk_paths").([]string)
|
||||
if len(moreDisks) > 0 {
|
||||
for i, path := range moreDisks {
|
||||
ui.Say(fmt.Sprintf("Compacting additional disk image %d",i+1))
|
||||
if err := driver.CompactDisk(path); err != nil {
|
||||
state.Put("error", fmt.Errorf("Error compacting additional disk %d: %s", i+1, err))
|
||||
return multistep.ActionHalt
|
||||
if state.Get("additional_disk_paths") != nil {
|
||||
if moreDisks := state.Get("additional_disk_paths").([]string); len(moreDisks) > 0 {
|
||||
for i, path := range moreDisks {
|
||||
ui.Say(fmt.Sprintf("Compacting additional disk image %d",i+1))
|
||||
if err := driver.CompactDisk(path); err != nil {
|
||||
state.Put("error", fmt.Errorf("Error compacting additional disk %d: %s", i+1, err))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return multistep.ActionContinue
|
||||
|
|
Loading…
Reference in New Issue