-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing HTTPError case of fetch_url for Python 3 compatibility. #45628
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a changelog fragment, and both unit and integration tests
@sivel I cannot figure out how to get httpbin to return headers with an error status code. Without that, I don't see how to add a usable integration test. Do you have any idea for that? |
Any status code Making a request to |
Ok, but then I cannot pass something on my own :) About integration tests: is there any way to call |
Restarting unrelated failing tests. |
We don't have decent support for doing http tests via direct python as integration tests. We can just rely on this fixing the broken test for acme_certificate. I see you have added units. |
Actually I will improve the |
(I'll add that to rebased #45603 once this is merged.) |
@sivel There's still one unrelated test failing: https://app.shippable.com/github/ansible/ansible/runs/83900/34/tests Can you restart it? |
@sivel (or whoever did that) Thanks for restarting it! :) How shall we proceed with this PR? Does this require more reviews, or can it be merged? |
This has been merged to devel for the 2.8 release. Please create backport PRs for stable-2.6 and stable-2.7: (Note: stable-2.5 does not have any of the lowercasing changes, so this should not be backported there) |
…le#45628) * Fixing HTTPError case of fetch_url for Python 3 compatibility. * Adding unit test. * PEP8. * Changelog.
…le#45628) * Fixing HTTPError case of fetch_url for Python 3 compatibility. * Adding unit test. * PEP8. * Changelog.
* Fixing HTTPError case of fetch_url for Python 3 compatibility. * Adding unit test. * PEP8. * Changelog.
* Fixing HTTPError case of fetch_url for Python 3 compatibility. * Adding unit test. * PEP8. * Changelog.
SUMMARY
This is a follow-up to #33792 which modified
fetch_url
to store headers lower-case (as Python 2 is doing) also for Python 3. There was one case missing: in case aHTTPError
is raised and itsinfo()
method is available, its headers have not been converted to lower-case.CC @sivel
ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/urls.py
ANSIBLE VERSION