Use "topics" instead of "topic" in Notifier initialization
The "topic" parameter of the __init__method of Notifier has been deprecated and will be removed. see change[1]. [1] Id89957411aa219cff92fafec2f448c81cb57b3ca Change-Id: If41b0aa4f9afc90d049063bf509723c3a8295db7
This commit is contained in:
parent
726f24334d
commit
f99cedf11f
@ -116,7 +116,7 @@ class NotificationService(service_base.PipelineBasedService):
|
|||||||
transport,
|
transport,
|
||||||
driver=cfg.CONF.publisher_notifier.telemetry_driver,
|
driver=cfg.CONF.publisher_notifier.telemetry_driver,
|
||||||
publisher_id=pipe.name,
|
publisher_id=pipe.name,
|
||||||
topic='%s-%s-%s' % (self.NOTIFICATION_IPC, pipe.name, x)))
|
topics=['%s-%s-%s' % (self.NOTIFICATION_IPC, pipe.name, x)]))
|
||||||
return notifiers
|
return notifiers
|
||||||
|
|
||||||
def _get_pipe_manager(self, transport, pipeline_manager):
|
def _get_pipe_manager(self, transport, pipeline_manager):
|
||||||
|
@ -192,12 +192,12 @@ class NotifierPublisher(MessagingPublisher):
|
|||||||
def __init__(self, parsed_url, default_topic):
|
def __init__(self, parsed_url, default_topic):
|
||||||
super(NotifierPublisher, self).__init__(parsed_url)
|
super(NotifierPublisher, self).__init__(parsed_url)
|
||||||
options = urlparse.parse_qs(parsed_url.query)
|
options = urlparse.parse_qs(parsed_url.query)
|
||||||
topic = options.get('topic', [default_topic])[-1]
|
topic = options.get('topic', [default_topic])
|
||||||
self.notifier = oslo_messaging.Notifier(
|
self.notifier = oslo_messaging.Notifier(
|
||||||
messaging.get_transport(),
|
messaging.get_transport(),
|
||||||
driver=cfg.CONF.publisher_notifier.telemetry_driver,
|
driver=cfg.CONF.publisher_notifier.telemetry_driver,
|
||||||
publisher_id='telemetry.publisher.%s' % cfg.CONF.host,
|
publisher_id='telemetry.publisher.%s' % cfg.CONF.host,
|
||||||
topic=topic,
|
topics=topic,
|
||||||
retry=self.retry
|
retry=self.retry
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,13 +107,13 @@ class NotifierOnlyPublisherTest(BasePublisherTestCase):
|
|||||||
def test_publish_topic_override(self, notifier):
|
def test_publish_topic_override(self, notifier):
|
||||||
msg_publisher.SampleNotifierPublisher(
|
msg_publisher.SampleNotifierPublisher(
|
||||||
netutils.urlsplit('notifier://?topic=custom_topic'))
|
netutils.urlsplit('notifier://?topic=custom_topic'))
|
||||||
notifier.assert_called_with(mock.ANY, topic='custom_topic',
|
notifier.assert_called_with(mock.ANY, topics=['custom_topic'],
|
||||||
driver=mock.ANY, retry=mock.ANY,
|
driver=mock.ANY, retry=mock.ANY,
|
||||||
publisher_id=mock.ANY)
|
publisher_id=mock.ANY)
|
||||||
|
|
||||||
msg_publisher.EventNotifierPublisher(
|
msg_publisher.EventNotifierPublisher(
|
||||||
netutils.urlsplit('notifier://?topic=custom_event_topic'))
|
netutils.urlsplit('notifier://?topic=custom_event_topic'))
|
||||||
notifier.assert_called_with(mock.ANY, topic='custom_event_topic',
|
notifier.assert_called_with(mock.ANY, topics=['custom_event_topic'],
|
||||||
driver=mock.ANY, retry=mock.ANY,
|
driver=mock.ANY, retry=mock.ANY,
|
||||||
publisher_id=mock.ANY)
|
publisher_id=mock.ANY)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def get_notifier(config_file):
|
|||||||
messaging.get_transport(),
|
messaging.get_transport(),
|
||||||
driver='messagingv2',
|
driver='messagingv2',
|
||||||
publisher_id='telemetry.publisher.test',
|
publisher_id='telemetry.publisher.test',
|
||||||
topic='metering',
|
topics=['metering'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user