From 0a0b09b394aaecf0a7ec6d8bb04b02b4c544568b Mon Sep 17 00:00:00 2001 From: beeankha Date: Tue, 25 Jun 2019 10:46:05 -0400 Subject: [PATCH] Update logic in send method to recognize password field in upgraded webhook notifications --- awx/main/models/notifications.py | 7 ++++--- docs/notification_system.md | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/awx/main/models/notifications.py b/awx/main/models/notifications.py index cdec14f953..fc99caf37c 100644 --- a/awx/main/models/notifications.py +++ b/awx/main/models/notifications.py @@ -118,9 +118,10 @@ class NotificationTemplate(CommonModelNameNotUnique): def send(self, subject, body): for field in filter(lambda x: self.notification_class.init_parameters[x]['type'] == "password", self.notification_class.init_parameters): - self.notification_configuration[field] = decrypt_field(self, - 'notification_configuration', - subfield=field) + if field in self.notification_configuration: + self.notification_configuration[field] = decrypt_field(self, + 'notification_configuration', + subfield=field) recipients = self.notification_configuration.pop(self.notification_class.recipient_parameter) if not isinstance(recipients, list): recipients = [recipients] diff --git a/docs/notification_system.md b/docs/notification_system.md index 40adb5c8af..cc7cc2a7e5 100644 --- a/docs/notification_system.md +++ b/docs/notification_system.md @@ -218,13 +218,13 @@ https://gist.github.com/matburt/73bfbf85c2443f39d272 The link below shows how to define an endpoint and parse headers and json content. It doesn't show how to configure Flask for HTTPS, but is fairly straightforward: http://flask.pocoo.org/snippets/111/ -You can also link an httpbin service to the development environment for testing webhooks using: +You can also link an `httpbin` service to the development environment for testing webhooks using: ``` make docker-compose-notifications ``` -This will create an `httpbin` service reachable from the awx container at `http://httpbin/post`, `http://httpbin/put`, etc. Outside of the container, you can reach the service at `http://localhost:8204`. +This will create an `httpbin` service reachable from the AWX container at `http://httpbin/post`, `http://httpbin/put`, etc. Outside of the container, you can reach the service at `http://localhost:8204`. ## Grafana