summaryrefslogtreecommitdiffstats
path: root/bin/stack
diff options
context:
space:
mode:
authorEwan Mellor <ewan.mellor@citrix.com>2011-10-30 15:58:31 -0700
committerEwan Mellor <ewan.mellor@citrix.com>2011-10-30 15:58:31 -0700
commit0f7f91c2e51586c659ab7e123ddee4d2a5d1f68a (patch)
tree893e1f2ff2e99d872cffce1f33c2e9220938f0ca /bin/stack
parent5b8133a83939fd552b569c4b034cef43907ea1ce (diff)
downloadnova-0f7f91c2e51586c659ab7e123ddee4d2a5d1f68a.tar.gz
nova-0f7f91c2e51586c659ab7e123ddee4d2a5d1f68a.tar.xz
nova-0f7f91c2e51586c659ab7e123ddee4d2a5d1f68a.zip
Bug #884018: "stack help" prints stacktrace if it cannot connect to the server
Add a handler for URLError, so that we print a nicer error message if stack cannot connect to the server. Change-Id: I24f977dcb12bee3bb21057fe9b19823d98581141
Diffstat (limited to 'bin/stack')
-rwxr-xr-xbin/stack3
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/stack b/bin/stack
index a1c6d1348..c8a99f073 100755
--- a/bin/stack
+++ b/bin/stack
@@ -118,6 +118,9 @@ 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)