mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 06:29:31 -02:30
Update the logic for 'any' and 'started' notifications
This commit is contained in:
@@ -235,16 +235,18 @@ class JobNotificationMixin(object):
|
|||||||
logger.warn("No notification template defined for emitting notification")
|
logger.warn("No notification template defined for emitting notification")
|
||||||
notification_templates = None
|
notification_templates = None
|
||||||
if notification_templates:
|
if notification_templates:
|
||||||
if status_str == 'succeeded':
|
all_notification_templates = set()
|
||||||
|
if status_str != 'running':
|
||||||
|
all_notification_templates.update(notification_templates.get('any', []))
|
||||||
|
notification_template_type = 'any'
|
||||||
|
elif status_str == 'succeeded':
|
||||||
notification_template_type = 'success'
|
notification_template_type = 'success'
|
||||||
elif status_str == 'running':
|
elif status_str == 'running':
|
||||||
notification_template_type = 'started'
|
notification_template_type = 'started'
|
||||||
else:
|
else:
|
||||||
notification_template_type = 'error'
|
notification_template_type = 'error'
|
||||||
all_notification_templates = set(notification_templates.get(notification_template_type, []))
|
all_notification_templates.update(notification_templates.get(notification_template_type, []))
|
||||||
if len(all_notification_templates):
|
if len(all_notification_templates):
|
||||||
if status_str != 'running':
|
|
||||||
all_notification_templates.update(notification_templates.get('any', []))
|
|
||||||
try:
|
try:
|
||||||
(notification_subject, notification_body) = getattr(self, 'build_notification_%s_message' % status_str)()
|
(notification_subject, notification_body) = getattr(self, 'build_notification_%s_message' % status_str)()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user