Update logic in send method to recognize password field in upgraded webhook notifications

This commit is contained in:
beeankha 2019-06-25 10:46:05 -04:00
parent 2b74b6f9b6
commit 0a0b09b394
2 changed files with 6 additions and 5 deletions

View File

@ -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]

View File

@ -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