Skip to content

Commit

Permalink
Merge pull request #11384 from jbradberry/failure-notification-on-error
Browse files Browse the repository at this point in the history
Make sure to fire off failure notifications on error
  • Loading branch information
jbradberry authored Dec 15, 2021
2 parents 1205d71 + c419969 commit b195f9d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions awx/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,9 +1543,11 @@ def run(self, pk, **kwargs):
status = res.status
rc = res.rc

if status == 'timeout':
self.instance.job_explanation = "Job terminated due to timeout"
status = 'failed'
if status in ('timeout', 'error'):
self.instance.job_explanation = f"Job terminated due to {status}"
if status == 'timeout':
status = 'failed'

extra_update_fields['job_explanation'] = self.instance.job_explanation
# ensure failure notification sends even if playbook_on_stats event is not triggered
handle_success_and_failure_notifications.apply_async([self.instance.job.id])
Expand Down

0 comments on commit b195f9d

Please sign in to comment.