Switched list_notifier to log an exception each time notify is called, for each notification driver that failed to import.

This commit is contained in:
Tim Simpson
2011-08-23 13:12:54 -05:00
parent 319daefd6b
commit 15fdf81804
2 changed files with 12 additions and 11 deletions

View File

@@ -30,6 +30,15 @@ LOG = logging.getLogger('nova.notifier.list_notifier')
drivers = None
class ImportFailureNotifier(object):
"""Noisily re-raises some exception over-and-over when notify is called."""
def __init__(self, exception):
self.exception = exception
def notify(message):
raise self.exception
def _get_drivers():
"""Instantiates and returns drivers based on the flag values."""
@@ -39,8 +48,8 @@ def _get_drivers():
for notification_driver in FLAGS.list_notifier_drivers:
try:
drivers.append(utils.import_object(notification_driver))
except ClassNotFound:
sys.exit(1)
except ClassNotFound as e:
drivers.append(ImportFailureNotifier(e))
return drivers
def notify(message):