Skip to content

Commit f99cedf

Browse files
author
liusheng
committed
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
1 parent 726f243 commit f99cedf

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

ceilometer/notification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _get_notifiers(self, transport, pipe):
116116
transport,
117117
driver=cfg.CONF.publisher_notifier.telemetry_driver,
118118
publisher_id=pipe.name,
119-
topic='%s-%s-%s' % (self.NOTIFICATION_IPC, pipe.name, x)))
119+
topics=['%s-%s-%s' % (self.NOTIFICATION_IPC, pipe.name, x)]))
120120
return notifiers
121121

122122
def _get_pipe_manager(self, transport, pipeline_manager):

ceilometer/publisher/messaging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ class NotifierPublisher(MessagingPublisher):
192192
def __init__(self, parsed_url, default_topic):
193193
super(NotifierPublisher, self).__init__(parsed_url)
194194
options = urlparse.parse_qs(parsed_url.query)
195-
topic = options.get('topic', [default_topic])[-1]
195+
topic = options.get('topic', [default_topic])
196196
self.notifier = oslo_messaging.Notifier(
197197
messaging.get_transport(),
198198
driver=cfg.CONF.publisher_notifier.telemetry_driver,
199199
publisher_id='telemetry.publisher.%s' % cfg.CONF.host,
200-
topic=topic,
200+
topics=topic,
201201
retry=self.retry
202202
)
203203

ceilometer/tests/unit/publisher/test_messaging_publisher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ class NotifierOnlyPublisherTest(BasePublisherTestCase):
107107
def test_publish_topic_override(self, notifier):
108108
msg_publisher.SampleNotifierPublisher(
109109
netutils.urlsplit('notifier://?topic=custom_topic'))
110-
notifier.assert_called_with(mock.ANY, topic='custom_topic',
110+
notifier.assert_called_with(mock.ANY, topics=['custom_topic'],
111111
driver=mock.ANY, retry=mock.ANY,
112112
publisher_id=mock.ANY)
113113

114114
msg_publisher.EventNotifierPublisher(
115115
netutils.urlsplit('notifier://?topic=custom_event_topic'))
116-
notifier.assert_called_with(mock.ANY, topic='custom_event_topic',
116+
notifier.assert_called_with(mock.ANY, topics=['custom_event_topic'],
117117
driver=mock.ANY, retry=mock.ANY,
118118
publisher_id=mock.ANY)
119119

tools/send_test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_notifier(config_file):
4848
messaging.get_transport(),
4949
driver='messagingv2',
5050
publisher_id='telemetry.publisher.test',
51-
topic='metering',
51+
topics=['metering'],
5252
)
5353

5454

0 commit comments

Comments
 (0)