summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-06-10 21:44:22 -0400
committerRussell Bryant <rbryant@redhat.com>2013-06-11 14:30:46 -0400
commit80476f0c6e70e23102495e383e98ae0e912e07f6 (patch)
tree71d0fc46e397704b5466001a8c0770d400bc66a3 /openstack
parent165b98415d3949f8a9dddbdbc1f304fb7d257718 (diff)
downloadoslo-80476f0c6e70e23102495e383e98ae0e912e07f6.tar.gz
oslo-80476f0c6e70e23102495e383e98ae0e912e07f6.tar.xz
oslo-80476f0c6e70e23102495e383e98ae0e912e07f6.zip
Add can_send_version() to RpcProxy.
Add a helper method to the RpcProxy class. This is a little nicer to use for checking to see if a given message is copmatible with the set version cap. Change-Id: Ic44d76f4181351dff367f2d1181a3d508a11db78
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/rpc/proxy.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/openstack/common/rpc/proxy.py b/openstack/common/rpc/proxy.py
index 3b74fe1..8523421 100644
--- a/openstack/common/rpc/proxy.py
+++ b/openstack/common/rpc/proxy.py
@@ -76,6 +76,11 @@ class RpcProxy(object):
"""Return the topic to use for a message."""
return topic if topic else self.topic
+ def can_send_version(self, version):
+ """Check to see if a version is compatible with the version cap."""
+ return (not self.version_cap or
+ rpc_common.version_is_compatible(self.version_cap, version))
+
@staticmethod
def make_namespaced_msg(method, namespace, **kwargs):
return {'method': method, 'namespace': namespace, 'args': kwargs}