Merge "Fix default value of RPC dispatcher access_policy"
This commit is contained in:
		@@ -170,9 +170,7 @@ class RPCDispatcher(dispatcher.DispatcherBase):
 | 
				
			|||||||
                raise TypeError('access_policy must be a subclass of '
 | 
					                raise TypeError('access_policy must be a subclass of '
 | 
				
			||||||
                                'RPCAccessPolicyBase')
 | 
					                                'RPCAccessPolicyBase')
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # TODO(pvinci): Change to DefaultRPCAccessPolicy when setting to
 | 
					            self.access_policy = DefaultRPCAccessPolicy()
 | 
				
			||||||
            # DefaultRCPAccessPolicy no longer breaks in tempest tests.
 | 
					 | 
				
			||||||
            self.access_policy = LegacyRPCAccessPolicy()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def _is_namespace(target, namespace):
 | 
					    def _is_namespace(target, namespace):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,8 +130,6 @@ __all__ = [
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from debtcollector.updating import updated_kwarg_default_value
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from oslo_messaging._i18n import _LE
 | 
					from oslo_messaging._i18n import _LE
 | 
				
			||||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
 | 
					from oslo_messaging.rpc import dispatcher as rpc_dispatcher
 | 
				
			||||||
from oslo_messaging import server as msg_server
 | 
					from oslo_messaging import server as msg_server
 | 
				
			||||||
@@ -187,15 +185,6 @@ class RPCServer(msg_server.MessageHandlingServer):
 | 
				
			|||||||
                del failure
 | 
					                del failure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@updated_kwarg_default_value('access_policy', None,
 | 
					 | 
				
			||||||
                             rpc_dispatcher.DefaultRPCAccessPolicy,
 | 
					 | 
				
			||||||
                             message='access_policy defaults to '
 | 
					 | 
				
			||||||
                                     'LegacyRPCAccessPolicy which '
 | 
					 | 
				
			||||||
                                     'exposes private methods. Explicitly '
 | 
					 | 
				
			||||||
                                     'set access_policy to '
 | 
					 | 
				
			||||||
                                     'DefaultRPCAccessPolicy or '
 | 
					 | 
				
			||||||
                                     'ExplicitRPCAccessPolicy.',
 | 
					 | 
				
			||||||
                             version='?')
 | 
					 | 
				
			||||||
def get_rpc_server(transport, target, endpoints,
 | 
					def get_rpc_server(transport, target, endpoints,
 | 
				
			||||||
                   executor='blocking', serializer=None, access_policy=None):
 | 
					                   executor='blocking', serializer=None, access_policy=None):
 | 
				
			||||||
    """Construct an RPC server.
 | 
					    """Construct an RPC server.
 | 
				
			||||||
@@ -212,7 +201,7 @@ def get_rpc_server(transport, target, endpoints,
 | 
				
			|||||||
    :param serializer: an optional entity serializer
 | 
					    :param serializer: an optional entity serializer
 | 
				
			||||||
    :type serializer: Serializer
 | 
					    :type serializer: Serializer
 | 
				
			||||||
    :param access_policy: an optional access policy.
 | 
					    :param access_policy: an optional access policy.
 | 
				
			||||||
           Defaults to LegacyRPCAccessPolicy
 | 
					           Defaults to DefaultRPCAccessPolicy
 | 
				
			||||||
    :type access_policy: RPCAccessPolicyBase
 | 
					    :type access_policy: RPCAccessPolicyBase
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    dispatcher = rpc_dispatcher.RPCDispatcher(endpoints, serializer,
 | 
					    dispatcher = rpc_dispatcher.RPCDispatcher(endpoints, serializer,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -158,7 +158,6 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
 | 
				
			|||||||
        oslo_messaging.get_rpc_server(transport, target,
 | 
					        oslo_messaging.get_rpc_server(transport, target,
 | 
				
			||||||
                                      endpoints, serializer=serializer)
 | 
					                                      endpoints, serializer=serializer)
 | 
				
			||||||
        self.assertEqual([
 | 
					        self.assertEqual([
 | 
				
			||||||
            mock.call(mock.ANY, category=FutureWarning, stacklevel=3),
 | 
					 | 
				
			||||||
            mock.call("blocking executor is deprecated. Executor default will "
 | 
					            mock.call("blocking executor is deprecated. Executor default will "
 | 
				
			||||||
                      "be removed. Use explicitly threading or eventlet "
 | 
					                      "be removed. Use explicitly threading or eventlet "
 | 
				
			||||||
                      "instead in version 'pike' and will be removed in "
 | 
					                      "instead in version 'pike' and will be removed in "
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					upgrade:
 | 
				
			||||||
 | 
					  - |
 | 
				
			||||||
 | 
					    Change the default value of RPC dispatcher access_policy
 | 
				
			||||||
 | 
					    to DefaultRPCAccessPolicy.
 | 
				
			||||||
		Reference in New Issue
	
	Block a user