Fix wrong api version type
The api version from openstack client is a string, not a number. So we need to convert it to the right type before comparing it with a version number. Closes-Bug: 1534378 Change-Id: I55f149b90028f89bb7ff0878a7450df981524026
This commit is contained in:
parent
2966750d9a
commit
0e2f625dd7
@ -32,6 +32,11 @@ API_VERSIONS = {
|
||||
def make_client(instance):
|
||||
"""Returns an queues service client."""
|
||||
version = instance._api_version[API_NAME]
|
||||
try:
|
||||
version = int(version)
|
||||
except ValueError:
|
||||
version = float(version)
|
||||
|
||||
queues_client = utils.get_client_class(
|
||||
API_NAME,
|
||||
version,
|
||||
|
@ -71,7 +71,7 @@ class Queue(object):
|
||||
right after it was called.
|
||||
"""
|
||||
req, trans = self.client._request_and_transport()
|
||||
if force_create or float(self.client.api_version) < 1.1:
|
||||
if force_create or self.client.api_version < 1.1:
|
||||
core.queue_create(trans, req, self._name)
|
||||
|
||||
def metadata(self, new_meta=None, force_reload=False):
|
||||
@ -95,7 +95,7 @@ class Queue(object):
|
||||
# NOTE(jeffrey4l): Ensure that metadata is cleared when the new_meta
|
||||
# is a empty dict.
|
||||
if new_meta is not None:
|
||||
if float(self.client.api_version) < 1.1:
|
||||
if self.client.api_version < 1.1:
|
||||
core.queue_set_metadata(trans, req, self._name, new_meta)
|
||||
else:
|
||||
core.queue_create(trans, req, self._name, metadata=new_meta)
|
||||
|
Loading…
x
Reference in New Issue
Block a user