Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/ansible/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (r *AnsibleOperatorReconciler) Reconcile(request reconcile.Request) (reconc
return reconcile.Result{}, err
}
}
if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() {
if event.Event == eventapi.EventRunnerOnFailed && !event.IgnoreError() && !event.Rescued() {
failureMessages = append(failureMessages, event.GetFailedPlaybookMessage())
}
}
Expand Down
12 changes: 12 additions & 0 deletions internal/ansible/runner/eventapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,15 @@ func (je JobEvent) IgnoreError() bool {
}
return false
}

// Rescued - Detects whether or not a task was rescued
func (je JobEvent) Rescued() bool {
if rescued, contains := je.EventData["rescued"]; contains {
for _, v := range rescued.(map[string]interface{}) {
if int(v.(float64)) == 1 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a drive-by comment :) but I happened to look at this PR and wondered -- is it always the case that "rescued" will only ever be 0 or 1? Is it possible multiple tasks could be rescued and thus this count could be 2, or 3, or ???

In which case, wouldn't it be more correct to say:

if int(v.(float64)) >= 1 

return true
}
}
}
return false
}