Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods with DefaultRPCAccessPolicy to fix FutureWarning Closes-Bug:1663543 Change-Id: I0288320193b0153ee223664696abca21cbdb0349
This commit is contained in:
committed by
Shubhendu Poothia
parent
e5eb4f51be
commit
2efe211f36
@@ -17,6 +17,8 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import oslo_messaging as messaging
|
import oslo_messaging as messaging
|
||||||
|
|
||||||
|
from oslo_messaging.rpc import dispatcher
|
||||||
|
|
||||||
from watcher.common import context as watcher_context
|
from watcher.common import context as watcher_context
|
||||||
from watcher.common import exception
|
from watcher.common import exception
|
||||||
|
|
||||||
@@ -128,12 +130,14 @@ def get_client(target, version_cap=None, serializer=None):
|
|||||||
|
|
||||||
def get_server(target, endpoints, serializer=None):
|
def get_server(target, endpoints, serializer=None):
|
||||||
assert TRANSPORT is not None
|
assert TRANSPORT is not None
|
||||||
|
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||||
serializer = RequestContextSerializer(serializer)
|
serializer = RequestContextSerializer(serializer)
|
||||||
return messaging.get_rpc_server(TRANSPORT,
|
return messaging.get_rpc_server(TRANSPORT,
|
||||||
target,
|
target,
|
||||||
endpoints,
|
endpoints,
|
||||||
executor='eventlet',
|
executor='eventlet',
|
||||||
serializer=serializer)
|
serializer=serializer,
|
||||||
|
access_policy=access_policy)
|
||||||
|
|
||||||
|
|
||||||
def get_notifier(publisher_id):
|
def get_notifier(publisher_id):
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ from oslo_reports import opts as gmr_opts
|
|||||||
from oslo_service import service
|
from oslo_service import service
|
||||||
from oslo_service import wsgi
|
from oslo_service import wsgi
|
||||||
|
|
||||||
|
from oslo_messaging.rpc import dispatcher
|
||||||
|
|
||||||
from watcher._i18n import _
|
from watcher._i18n import _
|
||||||
from watcher.api import app
|
from watcher.api import app
|
||||||
from watcher.common import config
|
from watcher.common import config
|
||||||
@@ -225,6 +227,7 @@ class Service(service.ServiceBase):
|
|||||||
self.conductor_client = c
|
self.conductor_client = c
|
||||||
|
|
||||||
def build_topic_handler(self, topic_name, endpoints=()):
|
def build_topic_handler(self, topic_name, endpoints=()):
|
||||||
|
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||||
serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
|
serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
|
||||||
target = om.Target(
|
target = om.Target(
|
||||||
topic=topic_name,
|
topic=topic_name,
|
||||||
@@ -234,7 +237,8 @@ class Service(service.ServiceBase):
|
|||||||
)
|
)
|
||||||
return om.get_rpc_server(
|
return om.get_rpc_server(
|
||||||
self.transport, target, endpoints,
|
self.transport, target, endpoints,
|
||||||
executor='eventlet', serializer=serializer)
|
executor='eventlet', serializer=serializer,
|
||||||
|
access_policy=access_policy)
|
||||||
|
|
||||||
def build_notification_handler(self, topic_names, endpoints=()):
|
def build_notification_handler(self, topic_names, endpoints=()):
|
||||||
serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
|
serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
|
||||||
|
|||||||
Reference in New Issue
Block a user