mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Fix dnf module crash for non-existent url (#81801)
* ci_complete ci_coverage
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Fix handling missing urls in ansible.module_utils.urls.fetch_file for Python 3.
|
||||
@@ -2058,7 +2058,7 @@ def fetch_file(module, url, data=None, headers=None, method=None,
|
||||
try:
|
||||
rsp, info = fetch_url(module, url, data, headers, method, use_proxy, force, last_mod_time, timeout,
|
||||
unredirected_headers=unredirected_headers, decompress=decompress, ciphers=ciphers)
|
||||
if not rsp:
|
||||
if not rsp or (rsp.code and rsp.code >= 400):
|
||||
module.fail_json(msg="Failure downloading %s, %s" % (url, info['msg']))
|
||||
data = rsp.read(bufsize)
|
||||
while data:
|
||||
|
||||
@@ -510,6 +510,7 @@
|
||||
that:
|
||||
- "dnf_result is failed"
|
||||
- "not dnf_result.changed"
|
||||
- "'Failure downloading' in dnf_result.msg or 'Failed to download' in dnf_result.msg"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
|
||||
Reference in New Issue
Block a user