summaryrefslogtreecommitdiff
path: root/cloudinit/url_helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/url_helper.py')
-rw-r--r--cloudinit/url_helper.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index 08e5f01b..bfc5cfdd 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -170,7 +170,9 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
# attrs
return UrlResponse(r)
except exceptions.RequestException as e:
- if isinstance(e, (exceptions.HTTPError)) and e.response:
+ if (isinstance(e, (exceptions.HTTPError))
+ and hasattr(e, 'response') # This appeared in v 0.10.8
+ and e.response):
excps.append(UrlError(e, code=e.response.status_code,
headers=e.response.headers))
else: