1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #7930 from trbs/apt_key_fetch_url_failure_codes

apt_key clear message when downloading key returns an (http) error code
This commit is contained in:
James Cammarata 2014-06-25 22:27:08 -05:00
commit 2305ac9881

View file

@ -153,8 +153,12 @@ def download_key(module, url):
# and reuse here
if url is None:
module.fail_json(msg="needed a URL but was not specified")
try:
rsp, info = fetch_url(module, url)
if info['status'] != 200:
module.fail_json(msg="Failed to download key at %s: %s" % (url, info['msg']))
return rsp.read()
except Exception:
module.fail_json(msg="error getting key id from url: %s" % url, traceback=format_exc())