From e54178f904d826904e2456bd8fa711d13480c5f7 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 11 Sep 2014 09:46:53 -0500 Subject: [PATCH] Catch additional errors in fetch_url Fixes #8971 --- lib/ansible/module_utils/urls.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 07d6c90627..1280745cc9 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -445,6 +445,10 @@ def fetch_url(module, url, data=None, headers=None, method=None, except urllib2.URLError, e: code = int(getattr(e, 'code', -1)) info.update(dict(msg="Request failed: %s" % str(e), status=code)) + except socket.error, e: + info.update(dict(msg="Connection failure: %s" % str(e), status=-1)) + except Exception, e: + info.update(dict(msg="An unknown error occurred: %s" % str(e), status=-1)) return r, info