Merge "Set access_policy for messaging's dispatcher"

This commit is contained in:
Jenkins 2017-02-10 01:49:39 +00:00 committed by Gerrit Code Review
commit 9e0e188119
3 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,7 @@ __all__ = [
]
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
import masakari.context
import masakari.exception
@ -104,12 +105,14 @@ def get_client(target, version_cap=None, serializer=None):
def get_server(target, endpoints, serializer=None):
assert TRANSPORT is not None
access_policy = dispatcher.DefaultRPCAccessPolicy
serializer = RequestContextSerializer(serializer)
return messaging.get_rpc_server(TRANSPORT,
target,
endpoints,
executor='eventlet',
serializer=serializer)
serializer=serializer,
access_policy=access_policy)
class RPCAPI(object):

View File

@ -14,6 +14,7 @@
import mock
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from masakari import context
from masakari import rpc
@ -106,12 +107,14 @@ class RPCAPITestCase(test.TestCase):
ends = mock.Mock()
mock_ser.return_value = ser
mock_get.return_value = 'server'
access_policy = dispatcher.DefaultRPCAccessPolicy
server = rpc.get_server(tgt, ends, serializer='foo')
mock_ser.assert_called_once_with('foo')
mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends,
executor='eventlet', serializer=ser)
executor='eventlet', serializer=ser,
access_policy=access_policy)
self.assertEqual('server', server)

View File

@ -10,7 +10,7 @@ keystonemiddleware!=4.5.0,>=4.2.0 # Apache-2.0
microversion-parse>=0.1.2 # Apache-2.0
oslo.config>=3.10.0 # Apache-2.0
oslo.db>=4.1.0 # Apache-2.0
oslo.messaging>=5.2.0 # Apache-2.0
oslo.messaging>=5.11.0 # Apache-2.0
oslo.i18n>=2.1.0 # Apache-2.0
oslo.log>=1.14.0 # Apache-2.0
oslo.middleware>=3.0.0 # Apache-2.0