From f286dc748670c67845df226ca7d400e745dd502f Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 21 Mar 2016 15:40:41 -0400 Subject: [PATCH] Fix an issue with the email notifier Incorrect body format assumptions in the email notifier --- awx/main/notifications/email_backend.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/awx/main/notifications/email_backend.py b/awx/main/notifications/email_backend.py index 9a9d0a9e2d..0c5b6efa2d 100644 --- a/awx/main/notifications/email_backend.py +++ b/awx/main/notifications/email_backend.py @@ -20,9 +20,12 @@ class CustomEmailBackend(EmailBackend): sender_parameter = "sender" def format_body(self, body): - body_actual = smart_text("{} #{} had status {} on Ansible Tower, view details at {}\n\n".format(body['friendly_name'], - body['id'], - body['status'], - body['url'])) - body_actual += pprint.pformat(body, indent=4) + if "body" in body: + body_actual = body['body'] + else: + body_actual = smart_text("{} #{} had status {} on Ansible Tower, view details at {}\n\n".format(body['friendly_name'], + body['id'], + body['status'], + body['url'])) + body_actual += pprint.pformat(body, indent=4) return body_actual