mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 12:27:37 -02:30
Refactor Notification backend for tower -> awx
This commit is contained in:
@@ -8,7 +8,7 @@ from django.core.mail.backends.base import BaseEmailBackend
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
class TowerBaseEmailBackend(BaseEmailBackend):
|
class AWXBaseEmailBackend(BaseEmailBackend):
|
||||||
|
|
||||||
def format_body(self, body):
|
def format_body(self, body):
|
||||||
if "body" in body:
|
if "body" in body:
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import requests
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.hipchat_backend')
|
logger = logging.getLogger('awx.main.notifications.hipchat_backend')
|
||||||
|
|
||||||
|
|
||||||
class HipChatBackend(TowerBaseEmailBackend):
|
class HipChatBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"token": {"label": "Token", "type": "password"},
|
init_parameters = {"token": {"label": "Token", "type": "password"},
|
||||||
"rooms": {"label": "Destination Rooms", "type": "list"},
|
"rooms": {"label": "Destination Rooms", "type": "list"},
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import irc.client
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.irc_backend')
|
logger = logging.getLogger('awx.main.notifications.irc_backend')
|
||||||
|
|
||||||
|
|
||||||
class IrcBackend(TowerBaseEmailBackend):
|
class IrcBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"server": {"label": "IRC Server Address", "type": "string"},
|
init_parameters = {"server": {"label": "IRC Server Address", "type": "string"},
|
||||||
"port": {"label": "IRC Server Port", "type": "int"},
|
"port": {"label": "IRC Server Port", "type": "int"},
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import pygerduty
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.pagerduty_backend')
|
logger = logging.getLogger('awx.main.notifications.pagerduty_backend')
|
||||||
|
|
||||||
|
|
||||||
class PagerDutyBackend(TowerBaseEmailBackend):
|
class PagerDutyBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"subdomain": {"label": "Pagerduty subdomain", "type": "string"},
|
init_parameters = {"subdomain": {"label": "Pagerduty subdomain", "type": "string"},
|
||||||
"token": {"label": "API Token", "type": "password"},
|
"token": {"label": "API Token", "type": "password"},
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ from slackclient import SlackClient
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.slack_backend')
|
logger = logging.getLogger('awx.main.notifications.slack_backend')
|
||||||
|
|
||||||
|
|
||||||
class SlackBackend(TowerBaseEmailBackend):
|
class SlackBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"token": {"label": "Token", "type": "password"},
|
init_parameters = {"token": {"label": "Token", "type": "password"},
|
||||||
"channels": {"label": "Destination Channels", "type": "list"}}
|
"channels": {"label": "Destination Channels", "type": "list"}}
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ from twilio.rest import Client
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.twilio_backend')
|
logger = logging.getLogger('awx.main.notifications.twilio_backend')
|
||||||
|
|
||||||
|
|
||||||
class TwilioBackend(TowerBaseEmailBackend):
|
class TwilioBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"account_sid": {"label": "Account SID", "type": "string"},
|
init_parameters = {"account_sid": {"label": "Account SID", "type": "string"},
|
||||||
"account_token": {"label": "Account Token", "type": "password"},
|
"account_token": {"label": "Account Token", "type": "password"},
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import requests
|
|||||||
|
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from awx.main.notifications.base import TowerBaseEmailBackend
|
from awx.main.notifications.base import AWXBaseEmailBackend
|
||||||
from awx.main.utils import get_awx_version
|
from awx.main.utils import get_awx_version
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.notifications.webhook_backend')
|
logger = logging.getLogger('awx.main.notifications.webhook_backend')
|
||||||
|
|
||||||
|
|
||||||
class WebhookBackend(TowerBaseEmailBackend):
|
class WebhookBackend(AWXBaseEmailBackend):
|
||||||
|
|
||||||
init_parameters = {"url": {"label": "Target URL", "type": "string"},
|
init_parameters = {"url": {"label": "Target URL", "type": "string"},
|
||||||
"headers": {"label": "HTTP Headers", "type": "object"}}
|
"headers": {"label": "HTTP Headers", "type": "object"}}
|
||||||
|
|||||||
Reference in New Issue
Block a user