Merge "Fix parsing of AMQP configuration"
This commit is contained in:
commit
4a02162a18
@ -64,16 +64,20 @@ class Notifier(object):
|
||||
|
||||
def __init__(self, strategy=None):
|
||||
|
||||
_driver = None
|
||||
_strategy = strategy
|
||||
|
||||
if CONF.notifier_strategy != 'default':
|
||||
msg = _("notifier_strategy was deprecated in "
|
||||
"favor of `notification_driver`")
|
||||
warnings.warn(msg, DeprecationWarning)
|
||||
|
||||
# NOTE(flaper87): Use this to keep backwards
|
||||
# compatibility. We'll try to get an oslo.messaging
|
||||
# driver from the specified strategy.
|
||||
_strategy = strategy or CONF.notifier_strategy
|
||||
_driver = _STRATEGY_ALIASES.get(_strategy)
|
||||
# NOTE(flaper87): Use this to keep backwards
|
||||
# compatibility. We'll try to get an oslo.messaging
|
||||
# driver from the specified strategy.
|
||||
_strategy = strategy or CONF.notifier_strategy
|
||||
_driver = _STRATEGY_ALIASES.get(_strategy)
|
||||
|
||||
publisher_id = CONF.default_publisher_id
|
||||
|
||||
# NOTE(flaper87): Assume the user has configured
|
||||
|
@ -114,6 +114,19 @@ class TestNotifier(utils.BaseTestCase):
|
||||
self.assertEqual(str(notify._transport._driver._url),
|
||||
transport_url)
|
||||
|
||||
def test_notification_driver_option(self):
|
||||
self.config(rpc_backend='qpid')
|
||||
self.config(notification_driver='messaging')
|
||||
self.config(notifier_strategy='rabbit')
|
||||
notify = notifier.Notifier()
|
||||
self.assertEqual(str(notify._transport._driver._url),
|
||||
'rabbit:///')
|
||||
|
||||
self.config(notifier_strategy='default')
|
||||
notify = notifier.Notifier()
|
||||
self.assertEqual(str(notify._transport._driver._url),
|
||||
'qpid:///')
|
||||
|
||||
|
||||
class TestImageNotifications(utils.BaseTestCase):
|
||||
"""Test Image Notifications work"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user