summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2012-10-21 20:44:23 -0700
committerJoshua Harlow <harlowja@gmail.com>2012-10-21 20:44:23 -0700
commit8036ff686ae7e1a884e6a78022dd86a8eab514ec (patch)
treed81957f669c05fe4615c98c90f5bb76077d4867a
parenteec668c2256fc32a8d0879e1d91340d307c0971f (diff)
downloadvyos-cloud-init-8036ff686ae7e1a884e6a78022dd86a8eab514ec.tar.gz
vyos-cloud-init-8036ff686ae7e1a884e6a78022dd86a8eab514ec.zip
Fix the checking and capturing of exceptions.
-rw-r--r--cloudinit/url_helper.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index c5921147..93df2510 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -130,12 +130,12 @@ def readurl(url, data=None, timeout=None, retries=0,
for _i in range(0, manual_tries):
try:
r = requests.request(**req_args)
+ if check_status:
+ r.raise_for_status()
except exceptions.RequestException as e:
last_excp = [e]
if last_excp:
raise last_excp[-1]
- if check_status:
- r.raise_for_status()
return UrlResponse(r.status_code, r.content, r.headers)