mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 17:28:51 -03:30
Merge pull request #7280 from apollo13/patch-1
Send content-type with mattermost notifications, fixes #7264 Reviewed-by: Ryan Petrello https://github.com/ryanpetrello
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
import json
|
|
||||||
|
|
||||||
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 _
|
||||||
@@ -45,7 +44,7 @@ class MattermostBackend(AWXBaseEmailBackend, CustomNotificationBase):
|
|||||||
payload['text'] = m.subject
|
payload['text'] = m.subject
|
||||||
|
|
||||||
r = requests.post("{}".format(m.recipients()[0]),
|
r = requests.post("{}".format(m.recipients()[0]),
|
||||||
data=json.dumps(payload), verify=(not self.mattermost_no_verify_ssl))
|
json=payload, verify=(not self.mattermost_no_verify_ssl))
|
||||||
if r.status_code >= 400:
|
if r.status_code >= 400:
|
||||||
logger.error(smart_text(_("Error sending notification mattermost: {}").format(r.text)))
|
logger.error(smart_text(_("Error sending notification mattermost: {}").format(r.text)))
|
||||||
if not self.fail_silently:
|
if not self.fail_silently:
|
||||||
|
|||||||
Reference in New Issue
Block a user