KeyError: 'Authorization'
hornet83 opened this issue · 5 comments
hornet83 commented
Hi there,
We are trying out the event driven ansible at the moment to improve our datacenter automation but are running in some issues when we send a curl to the webhook:
2023-05-09 23:13:33,453 - aiohttp.access - INFO - 127.0.0.1 [09/May/2023:23:13:33 +0000] "POST / HTTP/1.1" 500 245 "-" "curl/7.81.0"
2023-05-09 23:13:37,872 - aiohttp.server - ERROR - Error handling request
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
resp = await request_handler(request)
File "/home/ubuntu/.local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/home/ubuntu/.ansible/collections/ansible_collections/ansible/eda/extensions/eda/plugins/event_source/webhook.py", line 33, in webhook
headers.pop("Authorization")
KeyError: 'Authorization'
This is the curl:
curl -H 'Content-Type: application/json' -d '{"message": "Ansible is super cool"}' 127.0.0.1:5000/endpoint
The rulebook:
---
- name: Listen for events on a webhook
hosts: all
## Define our source for events
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000
## Define the conditions we are looking for
rules:
- name: Say Hello
condition: event.payload.message == "Ansible is super cool"
## Define the action we should take should the condition be met
action:
run_playbook:
name: say-what.yml
Any idea on what is causing the Authorization issue?
Thanks,
Stefan
Alex-Izquierdo commented
Hello. It happens with the latest version of the collection?
hornet83 commented
Hi, yes - I first did the install per docu and then downloaded the latest version from here as well - both are giving the same error.
Alex-Izquierdo commented
Oh, I see, the hotfix did not arrive on time, we need to release a new version. In the meantime, if you install the collection from the source code it should work.
ansible-galaxy collection install git+https://github.com/ansible/event-driven-ansible.git --force
hornet83 commented
that fixed it - cheers for that
Alex-Izquierdo commented
v1.3.7 released