summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc/matchmaker.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-11 02:31:30 +0000
committerGerrit Code Review <review@openstack.org>2013-02-11 02:31:30 +0000
commit9c727b28e83f08dcd7d247546557af54428c2417 (patch)
treecefe6493d98de6ead4ca6f56fabc4e2efc718cb7 /openstack/common/rpc/matchmaker.py
parent1febfc8132131f5961707b707324e6ff53bebf34 (diff)
parent4a1ec2169d0a75afffc61437735dfb3959530bc5 (diff)
downloadoslo-9c727b28e83f08dcd7d247546557af54428c2417.tar.gz
oslo-9c727b28e83f08dcd7d247546557af54428c2417.tar.xz
oslo-9c727b28e83f08dcd7d247546557af54428c2417.zip
Merge "Support testing args for LocalhostMatchMaker."
Diffstat (limited to 'openstack/common/rpc/matchmaker.py')
-rw-r--r--openstack/common/rpc/matchmaker.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/openstack/common/rpc/matchmaker.py b/openstack/common/rpc/matchmaker.py
index d68799b..07190f0 100644
--- a/openstack/common/rpc/matchmaker.py
+++ b/openstack/common/rpc/matchmaker.py
@@ -201,11 +201,12 @@ class FanoutRingExchange(RingExchange):
class LocalhostExchange(Exchange):
"""Exchange where all direct topics are local."""
- def __init__(self):
+ def __init__(self, host='localhost'):
+ self.host = host
super(Exchange, self).__init__()
def run(self, key):
- return [(key.split('.')[0] + '.localhost', 'localhost')]
+ return [('.'.join((key.split('.')[0], self.host)), self.host)]
class DirectExchange(Exchange):
@@ -237,11 +238,11 @@ class MatchMakerLocalhost(MatchMakerBase):
Match Maker where all bare topics resolve to localhost.
Useful for testing.
"""
- def __init__(self):
+ def __init__(self, host='localhost'):
super(MatchMakerLocalhost, self).__init__()
- self.add_binding(FanoutBinding(), LocalhostExchange())
+ self.add_binding(FanoutBinding(), LocalhostExchange(host))
self.add_binding(DirectBinding(), DirectExchange())
- self.add_binding(TopicBinding(), LocalhostExchange())
+ self.add_binding(TopicBinding(), LocalhostExchange(host))
class MatchMakerStub(MatchMakerBase):