summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharana Nandasena <charana@stackhpc.com>2018-08-14 00:30:55 +0100
committerThomas Bechtold <tbechtold@suse.com>2019-01-25 11:54:54 +0100
commit2bc16e78347b56cc0f6dd904e7f5c53d031634a5 (patch)
treef1b38fc0d70c5431c1e6a0bdabccec1afcc656a3
parent1d680f173988dd02f86a72330d3ed2f3710ac7d3 (diff)
Bug Fix: Parses notifier configuration options
Successfully parses configuration options for enabled notifiers. IMPORTANT: This requires the built-in notifiers be "enabled" in the configuration. This patch is compliant with `https://review.openstack.org/#/c/435136/` that in summary makes every notifier pluggable as apposed distinguished built-in and pluggable notifiers. Change-Id: I818212344268de5e90e72c5493a8632476ba254b Story: #2003794 Task: #26507
Notes
Notes (review): Code-Review+1: Thomas Bechtold <tbechtold@suse.com> Code-Review+2: Doug Szumski <doug@stackhpc.com> Code-Review+2: Joseph Davis <joseph.davis@suse.com> Workflow+1: Joseph Davis <joseph.davis@suse.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 31 Jan 2019 18:07:18 +0000 Reviewed-on: https://review.openstack.org/603154 Project: openstack/monasca-notification Branch: refs/heads/master
-rw-r--r--monasca_notification/conf/__init__.py8
-rw-r--r--monasca_notification/config.py3
2 files changed, 11 insertions, 0 deletions
diff --git a/monasca_notification/conf/__init__.py b/monasca_notification/conf/__init__.py
index 5dc861d..8928743 100644
--- a/monasca_notification/conf/__init__.py
+++ b/monasca_notification/conf/__init__.py
@@ -54,6 +54,14 @@ def register_opts(conf=None):
54 m.register_opts(conf) 54 m.register_opts(conf)
55 55
56 56
57def register_enabled_plugin_opts(conf=None):
58 if conf is None:
59 conf = CONF
60 for enabled_plugin in conf.notification_types.enabled:
61 ep_module = importutils.import_module(".".join(enabled_plugin.split(".")[:-1]))
62 ep_module.register_opts(conf)
63
64
57def list_opts(): 65def list_opts():
58 opts = collections.defaultdict(list) 66 opts = collections.defaultdict(list)
59 for m in CONF_OPTS: 67 for m in CONF_OPTS:
diff --git a/monasca_notification/config.py b/monasca_notification/config.py
index 64dd997..2654544 100644
--- a/monasca_notification/config.py
+++ b/monasca_notification/config.py
@@ -45,6 +45,9 @@ def parse_args(argv, no_yaml=False):
45 monasca-notification is an engine responsible for 45 monasca-notification is an engine responsible for
46 transforming alarm transitions into proper notifications 46 transforming alarm transitions into proper notifications
47 ''') 47 ''')
48
49 conf.register_enabled_plugin_opts(CONF)
50
48 log.setup(CONF, 51 log.setup(CONF,
49 product_name='monasca-notification', 52 product_name='monasca-notification',
50 version=version.version_string) 53 version=version.version_string)