Skip to content

Commit

Permalink
Merge pull request #3514 from dougm/issue-3506
Browse files Browse the repository at this point in the history
vcsim: fix panic in CancelTask
  • Loading branch information
dougm authored Aug 8, 2024
2 parents f13260d + db40be6 commit fc7056a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion govc/task/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (cmd *create) Run(ctx context.Context, f *flag.FlagSet) error {
return err
}

fmt.Println(res.Returnval.Task)
fmt.Println(res.Returnval.Task.Value)

return nil
}
9 changes: 9 additions & 0 deletions govc/test/tasks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ load test_helper
assert_success
task="$output"

run govc task.cancel "$task"
assert_success
cancelled=$(govc tasks -json | jq ".tasks[] | select(.key == \"$task\") | .cancelled")
assert_equal "true" "$cancelled"

run govc task.create "$id"
assert_success
task="$output"

run govc task.set -s running "$task"
assert_success

Expand Down
2 changes: 1 addition & 1 deletion simulator/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (t *Task) CancelTask(ctx *Context, req *types.CancelTask) soap.HasFault {
}

changes := []types.PropertyChange{
{Name: "info.canceled", Val: true},
{Name: "info.cancelled", Val: true},
{Name: "info.completeTime", Val: time.Now()},
{Name: "info.state", Val: types.TaskInfoStateError},
{Name: "info.error", Val: &types.LocalizedMethodFault{
Expand Down

0 comments on commit fc7056a

Please sign in to comment.