Log warning if ambiguous config key detected
This commit is contained in:
parent
26b78adb56
commit
cd2d16e6ac
|
@ -329,6 +329,8 @@ class WuttaConfig:
|
|||
if not isinstance(value, configuration.Configuration):
|
||||
return value
|
||||
|
||||
log.warning("ambiguous config key '%s' returns: %s", key, value)
|
||||
|
||||
# read from db last if so requested
|
||||
if usedb and not preferdb:
|
||||
value = self.get_from_db(key, session=session)
|
||||
|
|
|
@ -336,6 +336,17 @@ configure_logging = true
|
|||
|
||||
session.close()
|
||||
|
||||
def test_get_ambiguous(self):
|
||||
config = conf.WuttaConfig()
|
||||
|
||||
# value is returned if key is not ambiguous
|
||||
config.setdefault('foo', 'bar')
|
||||
self.assertEqual(config.get('foo'), 'bar')
|
||||
|
||||
# but None is returned if key is ambiguous
|
||||
config.setdefault('foo.bar', 'baz')
|
||||
self.assertIsNone(config.get('foo'))
|
||||
|
||||
def test_require(self):
|
||||
config = conf.WuttaConfig()
|
||||
self.assertRaises(ConfigurationError, config.require, 'foo')
|
||||
|
|
Loading…
Reference in a new issue