From 76728fcba7671575053620da9e1e26aaa279547a Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Thu, 12 May 2016 10:53:18 -0400 Subject: [PATCH] Set a user agent for the webhook if not provided --- awx/main/notifications/webhook_backend.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awx/main/notifications/webhook_backend.py b/awx/main/notifications/webhook_backend.py index 52d85483ab..fbefe78037 100644 --- a/awx/main/notifications/webhook_backend.py +++ b/awx/main/notifications/webhook_backend.py @@ -8,6 +8,7 @@ import json from django.utils.encoding import smart_text from awx.main.notifications.base import TowerBaseEmailBackend +from awx.main.utils import get_awx_version logger = logging.getLogger('awx.main.notifications.webhook_backend') @@ -27,6 +28,8 @@ class WebhookBackend(TowerBaseEmailBackend): def send_messages(self, messages): sent_messages = 0 + if 'User-Agent' not in self.headers: + self.headers['User-Agent'] = "Tower {}".format(get_awx_version()) for m in messages: r = requests.post("{}".format(m.recipients()[0]), data=json.dumps(m.body),