run_job_template action returns 401 when 443 port is present in CONTROLLER_URL
Alex-Izquierdo opened this issue · 0 comments
Alex-Izquierdo commented
Please confirm the following
- I agree to follow this project's code of conduct.
- I have checked the current issues for duplicates.
- I understand that ansible-rulebook is open source software provided for free and that I might not receive a timely response.
Bug Summary
When CONTROLLER_URL has an https scheme and it contains the default port (443) AWX returns a redirect without the port. A bug related with aiohttp library causes the deletion of the authorization header ending in a 401 response.
Regardless if the port is considered or not part of the host, this error can be avoided avoiding unnecessary redirects from AWX. This would not happen if the port is not the standard one (in that case AWX would return the port in the redirect and aiohttp client would resend the authorization header)
Environment
ansible-rulebook v1.0.0
Steps to reproduce
ansible-rulebook -r somerulebook.yml --controller-url https://some-awx:443 --controller-token some-valid-token --controller-ssl-verify no
Actual results
2023-07-18 19:23:22,870 - ansible_rulebook.job_template_runner - ERROR - Error connecting to controller 401, message='Unauthorized', url=URL('https://some-awx:443/api/v2/config/')
2023-07-18 19:23:22,872 - ansible_rulebook.cli - ERROR - Terminating 401, message='Unauthorized', url=URL('https://some-awx:443/api/v2/config/')
Expected results
The rulebook should work because it was provided a valid token.
Additional information
No response