Skip to content

Commit

Permalink
Update the logic for 'any' and 'started' notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
beeankha committed Jun 17, 2019
1 parent d511d63 commit c65e6ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions awx/main/models/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,18 @@ def send_notification_templates(self, status_str):
logger.warn("No notification template defined for emitting notification")
notification_templates = None
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'
elif status_str == 'running':
notification_template_type = 'started'
else:
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 status_str != 'running':
all_notification_templates.update(notification_templates.get('any', []))
try:
(notification_subject, notification_body) = getattr(self, 'build_notification_%s_message' % status_str)()
except AttributeError:
Expand Down

0 comments on commit c65e6ba

Please sign in to comment.