summaryrefslogtreecommitdiff
path: root/glanceclient/exc.py
diff options
context:
space:
mode:
authorisethi <iccha.sethi@rackspace.com>2012-09-07 20:54:09 +0000
committerisethi <iccha.sethi@rackspace.com>2012-09-10 16:22:45 +0000
commit5acd5a6a4adc430989ae05c434d0ac5a9a448b84 (patch)
tree754e28ab858a809e4e8e334fa29e2c5689bc43f0 /glanceclient/exc.py
parent61b359efa836b5e25d85892e2772fd9856062103 (diff)
downloadpython-glanceclient-5acd5a6a4adc430989ae05c434d0ac5a9a448b84.tar.gz
Catches HTTP 300 while printing responses
If glance v1 api is not enabled, and a request is made to it, it gives a KeyError. This patch catches the 300 error and displays error message. Fixes bug 1046607 Change-Id: I0009a5deca3b5dd5ccaeaea90feee21274bfe090
Diffstat (limited to 'glanceclient/exc.py')
-rw-r--r--glanceclient/exc.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/glanceclient/exc.py b/glanceclient/exc.py
index 78ca4f7..771d0e3 100644
--- a/glanceclient/exc.py
+++ b/glanceclient/exc.py
@@ -52,6 +52,16 @@ class HTTPException(ClientException):
return "%s (HTTP %s)" % (self.__class__.__name__, self.code)
+class HTTPMultipleChoices(HTTPException):
+ code = 300
+
+ def __str__(self):
+ self.details = ("Requested version of OpenStack Images API is not"
+ "available.")
+ return "%s (HTTP %s) %s" % (self.__class__.__name__, self.code,
+ self.details)
+
+
class BadRequest(HTTPException):
"""DEPRECATED"""
code = 400