Support older notifications set_override keys

Neutron and Ceilometer use set_override to set
the older deprecated key. We should support them
using the ConfFixture

Closes-Bug: #1521776
Change-Id: I2bd77284f80bc4525f062f313b1ec74f2b54b395
This commit is contained in:
Davanum Srinivas
2015-12-01 17:23:20 -05:00
committed by Oleksii Zamiatin
parent ba42571b5a
commit b6ad95e1ca
2 changed files with 52 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ __all__ = ['ConfFixture']
import sys
import fixtures
from functools import wraps
def _import_opts(conf, module, opts, group=None):
@@ -70,6 +71,24 @@ class ConfFixture(fixtures.Fixture):
'_notifier_opts',
'oslo_messaging_notifications')
# Support older test cases that still use the set_override
# with the old config key names
def decorator_for_set_override(wrapped_function):
@wraps(wrapped_function)
def _wrapper(*args, **kwargs):
group = 'oslo_messaging_notifications'
if args[0] == 'notification_driver':
args = ('driver', args[1], group)
elif args[0] == 'notification_transport_url':
args = ('transport_url', args[1], group)
elif args[0] == 'notification_topics':
args = ('topics', args[1], group)
return wrapped_function(*args, **kwargs)
return _wrapper
self.conf.set_override = decorator_for_set_override(
self.conf.set_override)
def setUp(self):
super(ConfFixture, self).setUp()
self.addCleanup(self.conf.reset)