Skip to content

Commit 512c168

Browse files
committed
fix: govc vm.destroy only destroys the 1st argument
With PR #2532 , vm.destroy was returning after the 1st VM was destroyed.
1 parent 13c6303 commit 512c168

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

govc/test/vm.bats

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ load test_helper
319319
# destroy powers off vm before destruction
320320
run govc vm.destroy $vm
321321
assert_success
322+
323+
run govc vm.destroy '*'
324+
assert_success
325+
326+
run govc find / -type m
327+
assert_success "" # expect all VMs are gone
322328
}
323329

324330
@test "vm.create pvscsi" {

govc/vm/destroy.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ func (cmd *destroy) Run(ctx context.Context, f *flag.FlagSet) error {
101101
return err
102102
}
103103

104-
return task.Wait(ctx)
104+
if err = task.Wait(ctx); err != nil {
105+
return err
106+
}
105107
}
106108

107109
return nil

0 commit comments

Comments
 (0)