Refactor notification backends to use CustomNotificationBase

This commit is contained in:
Jim Ladd
2019-10-15 17:30:56 -07:00
committed by Ryan Petrello
parent 6cd6a42e20
commit 4e9ec271c5
11 changed files with 49 additions and 53 deletions

View File

@@ -0,0 +1,14 @@
# Copyright (c) 2019 Ansible, Inc.
# All Rights Reserved.
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
class CustomNotificationBase(object):
DEFAULT_MSG = "{{ job_friendly_name }} #{{ job.id }} '{{ job.name }}' {{ job.status }}: {{ url }}"
DEFAULT_BODY = smart_text(_("{{ job_friendly_name }} #{{ job.id }} had status {{ job.status }}, view details at {{ url }}\n\n{{ job_summary_dict }}"))
default_messages = {"started": {"message": DEFAULT_MSG, "body": None},
"success": {"message": DEFAULT_MSG, "body": None},
"error": {"message": DEFAULT_MSG, "body": None}}