From a0f397eb6c4591a55a51451f23a5943d6405d9ee Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 27 Apr 2016 06:47:36 -0700 Subject: [PATCH] Fix traceback in fetch_urls when status code is in info as well as the error. --- lib/ansible/module_utils/urls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 2618567286..fe5ad7fa4e 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -901,7 +901,8 @@ def fetch_url(module, url, data=None, headers=None, method=None, body = e.read() except AttributeError: 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: code = int(getattr(e, 'code', -1)) info.update(dict(msg="Request failed: %s" % str(e), status=code))