summaryrefslogtreecommitdiffstats
path: root/openstack/common
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-18 12:35:19 +0000
committerGerrit Code Review <review@openstack.org>2013-07-18 12:35:19 +0000
commit79b8840f5e6ac95f850cbc1236bfebffb5e1349f (patch)
tree99d73359d15e3da6ad16adbc8c29f8f6a7ec8684 /openstack/common
parentb4148c2b88069f50eb0b215daf71d798fd0d892c (diff)
parent593aa3db3d94a1cd8024a64b7af865387483c21e (diff)
downloadoslo-79b8840f5e6ac95f850cbc1236bfebffb5e1349f.tar.gz
oslo-79b8840f5e6ac95f850cbc1236bfebffb5e1349f.tar.xz
oslo-79b8840f5e6ac95f850cbc1236bfebffb5e1349f.zip
Merge "Remove the unused notifier.add_driver() API"
Diffstat (limited to 'openstack/common')
-rw-r--r--openstack/common/notifier/api.py27
1 files changed, 7 insertions, 20 deletions
diff --git a/openstack/common/notifier/api.py b/openstack/common/notifier/api.py
index df89f67..edc1b4a 100644
--- a/openstack/common/notifier/api.py
+++ b/openstack/common/notifier/api.py
@@ -157,29 +157,16 @@ def _get_drivers():
if _drivers is None:
_drivers = {}
for notification_driver in CONF.notification_driver:
- add_driver(notification_driver)
-
+ try:
+ driver = importutils.import_module(notification_driver)
+ _drivers[notification_driver] = driver
+ except ImportError:
+ LOG.exception(_("Failed to load notifier %s. "
+ "These notifications will not be sent.") %
+ notification_driver)
return _drivers.values()
-def add_driver(notification_driver):
- """Add a notification driver at runtime."""
- # Make sure the driver list is initialized.
- _get_drivers()
- if isinstance(notification_driver, basestring):
- # Load and add
- try:
- driver = importutils.import_module(notification_driver)
- _drivers[notification_driver] = driver
- except ImportError:
- LOG.exception(_("Failed to load notifier %s. "
- "These notifications will not be sent.") %
- notification_driver)
- else:
- # Driver is already loaded; just add the object.
- _drivers[notification_driver] = notification_driver
-
-
def _reset_drivers():
"""Used by unit tests to reset the drivers."""
global _drivers