mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
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.
This commit is contained in:
parent
a2320c5b5e
commit
90a26de180
@ -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)()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user