summaryrefslogtreecommitdiffstats
path: root/bin/stack
diff options
context:
space:
mode:
authorEwan Mellor <ewan.mellor@citrix.com>2011-11-27 20:12:42 -0800
committerEwan Mellor <ewan.mellor@citrix.com>2011-11-27 20:14:40 -0800
commit2f70137a1b4951be56ebeb25a186e53551306faa (patch)
tree81b689303b213b8199fa334c340d7ad9c9f06807 /bin/stack
parent356ec713068b82af3cf449815ae76d82b4f86242 (diff)
downloadnova-2f70137a1b4951be56ebeb25a186e53551306faa.tar.gz
nova-2f70137a1b4951be56ebeb25a186e53551306faa.tar.xz
nova-2f70137a1b4951be56ebeb25a186e53551306faa.zip
Bug #897054: stack crashes with AttributeError on e.reason if the server returns an error
Swap the URLError and HTTPError exception handlers. HTTPError is a subclass of URLError, so the HTTPError handler wasn't being reached. Change-Id: Iec86d2b345dbd37858af888bbd54a74884025eda
Diffstat (limited to 'bin/stack')
-rwxr-xr-xbin/stack6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/stack b/bin/stack
index c8a99f073..0b226b7c1 100755
--- a/bin/stack
+++ b/bin/stack
@@ -118,12 +118,12 @@ def do_request(controller, method, params=None):
req = urllib2.Request(url, data, headers)
try:
resp = urllib2.urlopen(req)
- except urllib2.URLError, e:
- print 'Failed to connect to %s: %s' % (url, e.reason)
- sys.exit(1)
except urllib2.HTTPError, e:
print e.read()
sys.exit(1)
+ except urllib2.URLError, e:
+ print 'Failed to connect to %s: %s' % (url, e.reason)
+ sys.exit(1)
return json.loads(resp.read())