summaryrefslogtreecommitdiff
path: root/openstack_dashboard
diff options
context:
space:
mode:
authorMatthias Runge <mrunge@redhat.com>2014-07-11 12:45:19 +0200
committerMatthias Runge <mrunge@redhat.com>2014-07-11 14:04:09 +0200
commit322004f8480e40af5e77ed843ff803005d5af27c (patch)
tree23f42ecb11774a721940f0c4c43c626b8cf58a2d /openstack_dashboard
parent0093ef0b030a2d79ebc846a29ac40b646d535fc4 (diff)
downloadhorizon-322004f8480e40af5e77ed843ff803005d5af27c.tar.gz
adapt to python-novaclient-2.18.0
Novaclient renamed HTTPNotImplemented to HttpNotImplemented and changed the attribute code to status in exceptions This change should make the code work on newer and older versions. Change-Id: Ifef6c4c1b2924b03df00f427cfe3e6a7f415e569 Closes-Bug: #1340596
Diffstat (limited to 'openstack_dashboard')
-rw-r--r--openstack_dashboard/dashboards/project/instances/console.py7
-rw-r--r--openstack_dashboard/test/test_data/exceptions.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/console.py b/openstack_dashboard/dashboards/project/instances/console.py
index c197db97a..a37b09d24 100644
--- a/openstack_dashboard/dashboards/project/instances/console.py
+++ b/openstack_dashboard/dashboards/project/instances/console.py
@@ -42,11 +42,16 @@ def get_console(request, console_type, instance):
raise exceptions.NotAvailable(msg)
for api_call in check_consoles.values():
+ # ugly workaround due novaclient API change from 2.17 to 2.18
+ try:
+ httpnotimplemented = nova_exception.HttpNotImplemented
+ except AttributeError:
+ httpnotimplemented = nova_exception.HTTPNotImplemented
try:
console = api_call(request, instance.id)
#if not supported don't log it to avoid lot of errors
#in case of AUTO
- except nova_exception.HTTPNotImplemented:
+ except httpnotimplemented:
continue
except Exception:
LOG.debug('Console not available', exc_info=True)
diff --git a/openstack_dashboard/test/test_data/exceptions.py b/openstack_dashboard/test/test_data/exceptions.py
index 947d6872d..b3c8be547 100644
--- a/openstack_dashboard/test/test_data/exceptions.py
+++ b/openstack_dashboard/test/test_data/exceptions.py
@@ -28,7 +28,11 @@ def create_stubbed_exception(cls, status_code=500):
msg = "Expected failure."
def fake_init_exception(self, code=None, message=None, **kwargs):
- self.code = code
+ if code is not None:
+ if hasattr(self, 'http_status'):
+ self.http_status = code
+ else:
+ self.code = code
self.message = message or self.__class__.message
try: