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: Ide12f0b458e60400b7ae7878841edd2e4f808bdb
This commit is contained in:
shubhendu 2017-06-15 10:20:46 +05:30
parent 9abab3ac7f
commit 3e1ffeeaaa
1 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,7 @@
# limitations under the License.
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from mistral import context as ctx
from mistral.rpc import base as rpc
@ -42,12 +43,14 @@ class OsloRPCServer(rpc.RPCServer):
# TODO(rakhmerov): rpc.get_transport() should be in oslo.messaging
# related module.
access_policy = dispatcher.DefaultRPCAccessPolicy
self.oslo_server = messaging.get_rpc_server(
rpc.get_transport(),
target,
self.endpoints,
executor=executor,
serializer=ctx.RpcContextSerializer()
serializer=ctx.RpcContextSerializer(),
access_policy=access_policy
)
self.oslo_server.start()