Don't set enforce_type if we are using the default

The test fixture for oslo.config always sets enforce_type parameter in
set_default, however because of debtcollector, this means it also
always emits a deprecation warning as well, even when the caller never
set this parameter.

oslo.config's fixtures should not trigger deprecation warnings during
normal usage. So be extra careful and fix that.

Change-Id: I5471b5d164ff40785e07b5f66e1f4673cf716971
This commit is contained in:
Sean Dague 2017-06-12 14:24:24 -04:00
parent acad0dac61
commit 6e420e9de5
1 changed files with 6 additions and 1 deletions

View File

@ -70,7 +70,12 @@ class Config(fixtures.Fixture):
group = kw.pop('group', None)
enforce_type = kw.pop('enforce_type', True)
for k, v in kw.items():
self.conf.set_override(k, v, group, enforce_type=enforce_type)
if enforce_type is False:
self.conf.set_override(k, v, group, enforce_type=False)
else:
# this removes the deprecation warning if you are just
# using defaults
self.conf.set_override(k, v, group)
def _unregister_config_opts(self):
for group in self._registered_config_opts: