Use API version checking directly

Somewhere we're using req.api.is_supported('queue_set_metadata') to
check the api version. It works but not elegant. This patch will
use api version checking directly.

Change-Id: Ifb4f8777bc6c6e058e548650d28b89bbc10f6ef1
This commit is contained in:
Fei Long Wang
2016-01-20 11:43:42 +13:00
parent 8962837f88
commit fc00f4c910

View File

@@ -69,7 +69,7 @@ class Queue(object):
right after it was called.
"""
req, trans = self.client._request_and_transport()
if force_create or req.api.is_supported('queue_set_metadata'):
if force_create or float(self.client.api_version) < 1.1:
core.queue_create(trans, req, self._name)
def metadata(self, new_meta=None, force_reload=False):
@@ -93,7 +93,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 req.api.is_supported('queue_set_metadata'):
if float(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)