summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2016-04-27 06:47:36 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2016-05-09 09:34:20 -0700
commit6f23635cce1e96be78d8c7ac12114e7e5cd00a8e (patch)
tree3c9ae92bc95e1e0d9563b5537da45c1d1b2cf5d6
parent772eafd61a5bbc5c86d7a6f826fc6b3f177dca00 (diff)
downloadansible-6f23635cce1e96be78d8c7ac12114e7e5cd00a8e.tar.gz
Fix traceback in fetch_urls when status code is in info as well as the error.
-rw-r--r--lib/ansible/module_utils/urls.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py
index ac481e90a8..c760bda0e8 100644
--- a/lib/ansible/module_utils/urls.py
+++ b/lib/ansible/module_utils/urls.py
@@ -852,7 +852,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))