Change email notification formatting.

Instead of pretty printing the datastructure we'll now dump out the
result in json format with indent=4 for pretty viewing.
This commit is contained in:
Matthew Jones 2016-06-22 11:51:15 -04:00
parent c6cd966fc8
commit c812e85f65
3 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
import pprint
import json
from django.utils.encoding import smart_text
from django.core.mail.backends.base import BaseEmailBackend
@ -16,5 +16,5 @@ class TowerBaseEmailBackend(BaseEmailBackend):
body['id'],
body['status'],
body['url']))
body_actual += pprint.pformat(body, indent=4)
body_actual += json.dumps(body, indent=4)
return body_actual

View File

@ -1,7 +1,7 @@
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
import pprint
import json
from django.utils.encoding import smart_text
from django.core.mail.backends.smtp import EmailBackend
@ -27,5 +27,5 @@ class CustomEmailBackend(EmailBackend):
body['id'],
body['status'],
body['url']))
body_actual += pprint.pformat(body, indent=4)
body_actual += json.dumps(body, indent=4)
return body_actual

View File

@ -269,7 +269,8 @@ def handle_work_error(self, task_id, subtasks=None):
friendly_name = "System Job"
else:
# Unknown task type
break
logger.warn("Unknown task type: {}".format(each_task['type']))
continue
if first_task is None:
first_task = instance
first_task_id = instance.id