Merge "Kill 'Skipping unknown group key: firewall_driver' log trace"

This commit is contained in:
Jenkins 2014-03-19 05:04:18 +00:00 committed by Gerrit Code Review
commit 174825c549
3 changed files with 18 additions and 6 deletions

View File

@ -17,6 +17,8 @@
# @author Mark McClain (DreamHost)
from oslo.config import cfg
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
@ -45,10 +47,18 @@ def override_config(config, config_keys=None):
group = None
if not isinstance(key, basestring):
try:
group, key = key
group, key, module_str = key
old_value = getattr(getattr(config, group), key, None)
except AttributeError:
LOG.error(_('Skipping unknown group key: %s'), key)
try:
config.import_opt(key, module_str, group)
old_value = getattr(getattr(config, group), key, None)
except (cfg.NoSuchOptError,
cfg.NoSuchGroupError,
AttributeError):
LOG.warn(_('Key %(key)s in group %(group)s is unknown. '
'It may not be defined or needed by this '
'service.') % {'key': key, 'group': group})
continue
else:
old_value = getattr(config, key, None)
@ -77,7 +87,9 @@ def modernize_quantum_config(config):
'router_scheduler_driver',
'rpc_backend',
'service_plugins',
('SECURITYGROUP', 'firewall_driver'),
('SECURITYGROUP',
'firewall_driver',
'neutron.agent.securitygroups_rpc'),
]
override_config(config, config_keys)

View File

@ -58,7 +58,7 @@ quota_opts = [
]
# Register the configuration options
cfg.CONF.register_opts(quota_opts, 'QUOTAS')
legacy.override_config(cfg.CONF, [('QUOTAS', 'quota_driver')])
legacy.override_config(cfg.CONF, [('QUOTAS', 'quota_driver', 'neutron.quota')])
class ConfDriver(object):

View File

@ -71,7 +71,7 @@ class TestLegacyConfigOverride(base.BaseTestCase):
def test_override_config_group_key(self):
self.cfg(args=['--bar-baz=quantum'])
legacy.override_config(self.cfg, [('bar', 'baz')])
legacy.override_config(self.cfg, [('bar', 'baz', 'mod')])
self.assertEqual(self.cfg.bar.baz, 'neutron')
def test_override_config_list_value(self):