Browse Source

Set access_policy for messaging's dispatcher

Oslo messaging allow dispatcher to restrict endpoint methods
since 5.11.0 in https://review.openstack.org/#/c/358359/,
set with DefaultRPCAccessPolicy to fix FutureWarning like:

"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: Ic9a3122a02dd1e5c76b45c04801f4c9b3ce8a757
changes/28/413528/3
shizhihui 5 years ago
parent
commit
f6eb328dc8
  1. 5
      karbor/rpc.py

5
karbor/rpc.py

@ -25,6 +25,7 @@ __all__ = [
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils
import karbor.context
@ -122,11 +123,13 @@ def get_client(target, version_cap=None, serializer=None):
def get_server(target, endpoints, serializer=None):
assert TRANSPORT is not None
serializer = RequestContextSerializer(serializer)
access_policy = dispatcher.DefaultRPCAccessPolicy
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):

Loading…
Cancel
Save