From 90a26de1805e090e2ad4886b0c8bafe73d894eb9 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 6 Mar 2017 15:18:38 -0500 Subject: [PATCH] Fix an issue where notifications might not always be triggered In the case where a notification template were assigned to "failed" events but not "success" or "any" events. --- awx/main/tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 584e6ce0bb..91ef460f16 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -218,7 +218,11 @@ def _send_notification_templates(instance, status_str): raise ValueError(_("status_str must be either succeeded or failed")) notification_templates = instance.get_notification_templates() if notification_templates: - all_notification_templates = set(notification_templates.get('success', []) + notification_templates.get('any', [])) + if status_str == 'succeeded': + notification_template_type = 'success' + else: + notification_template_type = 'error' + all_notification_templates = set(notification_templates.get(notification_template_type, []) + notification_templates.get('any', [])) if len(all_notification_templates): try: (notification_subject, notification_body) = getattr(instance, 'build_notification_%s_message' % status_str)()