Set access_policy for messaging's dispatcher

oslo.messaging allow dispatcher to restrict endpoint methods
since 5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:

FutureWarning: The access_policy argument is changing its default
value to <class 'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'>
in version '?', please update the code to explicitly set None as the
value: access_policy defaults to LegacyRPCAccessPolicy which exposes
private methods. Explicitly set access_policy to DefaultRPCAccessPolicy
or ExplicitRPCAccessPolicy.

Change-Id: Iacb22af0836ead11043f6852fa17c6e024311a3c
This commit is contained in:
shubhendu 2017-04-26 10:54:04 +05:30 committed by Shubhendu Poothia
parent c3c5bc09d1
commit fa05a50249

View File

@ -27,6 +27,7 @@ __all__ = [
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils
import manila.context
@ -123,12 +124,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)
def get_notifier(service=None, host=None, publisher_id=None):