Browse Source

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
Charana Nandasena 8 months ago
parent
commit
2bc16e7834
2 changed files with 11 additions and 0 deletions
  1. 8
    0
      monasca_notification/conf/__init__.py
  2. 3
    0
      monasca_notification/config.py

+ 8
- 0
monasca_notification/conf/__init__.py View File

@@ -54,6 +54,14 @@ def register_opts(conf=None):
54 54
         m.register_opts(conf)
55 55
 
56 56
 
57
+def 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
+
57 65
 def list_opts():
58 66
     opts = collections.defaultdict(list)
59 67
     for m in CONF_OPTS:

+ 3
- 0
monasca_notification/config.py View File

@@ -45,6 +45,9 @@ def parse_args(argv, no_yaml=False):
45 45
          monasca-notification is an engine responsible for
46 46
          transforming alarm transitions into proper notifications
47 47
          ''')
48
+
49
+    conf.register_enabled_plugin_opts(CONF)
50
+
48 51
     log.setup(CONF,
49 52
               product_name='monasca-notification',
50 53
               version=version.version_string)

Loading…
Cancel
Save