mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-17 07:48:39 -05:00
Refactor message generator
* Job object can now control the output and generate K:V output for notification types that can support it * Notifications store the body as json/dict now to encode more information * Notification Type can further compose the message based on what is sensible for the notification type * This will also allow customizing the message template in the future * All notification types use sane defaults for the level of detail now
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
import logging
|
||||
from slackclient import SlackClient
|
||||
|
||||
from django.core.mail.backends.base import BaseEmailBackend
|
||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
||||
|
||||
logger = logging.getLogger('awx.main.notifications.slack_backend')
|
||||
|
||||
class SlackBackend(BaseEmailBackend):
|
||||
class SlackBackend(TowerBaseEmailBackend):
|
||||
|
||||
init_parameters = {"token": {"label": "Token", "type": "password"},
|
||||
"channels": {"label": "Destination Channels", "type": "list"}}
|
||||
@@ -41,7 +41,7 @@ class SlackBackend(BaseEmailBackend):
|
||||
for m in messages:
|
||||
try:
|
||||
for r in m.recipients():
|
||||
self.connection.rtm_send_message(r, m.body)
|
||||
self.connection.rtm_send_message(r, m.subject)
|
||||
sent_messages += 1
|
||||
except Exception as e:
|
||||
logger.error("Exception sending messages: {}".format(e))
|
||||
|
||||
Reference in New Issue
Block a user