Handle correct exception raised by python-novaclient

We need to hanle both novaclient.exceptions.RequestTimeout
and requests.Timeout to make it works with a different
python-nocaclient versions.

Change-Id: Ib58101f12c87653aef97e055d22542acbeeee4a7
Closes-Bug: #1510790
This commit is contained in:
Ivan Kolodyazhny 2015-10-28 07:45:57 +02:00
parent cbb55074de
commit 99dc6d3475
1 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ class API(base.Base):
def has_extension(self, context, extension, timeout=None):
try:
nova_exts = nova_client.discover_extensions(NOVA_API_VERSION)
except request_exceptions.Timeout:
except (nova_exceptions.RequestTimeout, request_exceptions.Timeout):
raise exception.APITimeout(service='Nova')
return extension in [e.name for e in nova_exts]
@ -196,5 +196,5 @@ class API(base.Base):
timeout=timeout).servers.get(server_id)
except nova_exceptions.NotFound:
raise exception.ServerNotFound(uuid=server_id)
except request_exceptions.Timeout:
except (nova_exceptions.RequestTimeout, request_exceptions.Timeout):
raise exception.APITimeout(service='Nova')