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

Fix traceback in fetch_urls when status code is in info as well as the error.

This commit is contained in:
Toshio Kuratomi 2016-04-27 06:47:36 -07:00
parent d14d4fc72f
commit a0f397eb6c

View file

@ -901,7 +901,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
body = e.read() body = e.read()
except AttributeError: except AttributeError:
body = '' body = ''
info.update(dict(msg=str(e), status=e.code, body=body, **e.info())) info.update(dict(msg=str(e), body=body, **e.info()))
info['status'] = e.code
except urllib2.URLError, e: except urllib2.URLError, e:
code = int(getattr(e, 'code', -1)) code = int(getattr(e, 'code', -1))
info.update(dict(msg="Request failed: %s" % str(e), status=code)) info.update(dict(msg="Request failed: %s" % str(e), status=code))