From 050024f7984397010c38cbfb8626112d33cbec43 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Tue, 8 Dec 2015 08:03:55 +0000 Subject: [PATCH] Fix notifier options registration Change-Id: I37082f6f349e89af6b74e6ec5e5c416902299263 --- oslo_messaging/notify/notifier.py | 4 ++-- tools/simulator.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/oslo_messaging/notify/notifier.py b/oslo_messaging/notify/notifier.py index fb841644f..cc4f2eb8f 100644 --- a/oslo_messaging/notify/notifier.py +++ b/oslo_messaging/notify/notifier.py @@ -90,9 +90,9 @@ class Driver(object): def get_notification_transport(conf, url=None, allowed_remote_exmods=None, aliases=None): + conf.register_opts(_notifier_opts, + group='oslo_messaging_notifications') if url is None: - conf.register_opts(_notifier_opts, - group='oslo_messaging_notifications') url = conf.oslo_messaging_notifications.transport_url return msg_transport.get_transport(conf, url, allowed_remote_exmods, aliases) diff --git a/tools/simulator.py b/tools/simulator.py index 3c587d5a0..03afe0884 100755 --- a/tools/simulator.py +++ b/tools/simulator.py @@ -281,16 +281,20 @@ def main(): _setup_logging(is_debug=args.debug) + if args.mode in ['rpc-server', 'rpc-client']: + transport = messaging.get_transport(cfg.CONF, url=args.url) + else: + transport = messaging.get_notification_transport(cfg.CONF, + url=args.url) + cfg.CONF.oslo_messaging_notifications.topics = "notif" + cfg.CONF.oslo_messaging_notifications.driver = "messaging" + target = messaging.Target(topic=args.topic, server='profiler_server') + # oslo.config defaults cfg.CONF.heartbeat_interval = 5 - cfg.CONF.oslo_messaging_notifications.topics = "notif" - cfg.CONF.oslo_messaging_notifications.driver = "messaging" cfg.CONF.prog = os.path.basename(__file__) cfg.CONF.project = 'oslo.messaging' - transport = messaging.get_transport(cfg.CONF, url=args.url) - target = messaging.Target(topic=args.topic, server='profiler_server') - if args.mode == 'rpc-server': if args.url.startswith('zmq'): cfg.CONF.rpc_zmq_matchmaker = "redis"