mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
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:
parent
c6cd966fc8
commit
c812e85f65
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user