Remove usage of parameter enforce_type

Oslo.config deprecated parameter enforce_type and change its default
value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0. Remove the
usage of it to avoid DeprecationWarning: "Using the 'enforce_type'
argument is deprecated in version '4.0' and will be removed in version
'5.0': The argument enforce_type has changed its default value to True
and then will be removed completely."

Closes-Bug: #1694616
Change-Id: I817a4860add1a4b1a39634e7f3162749f08212e0
This commit is contained in:
rajat29 2017-05-31 15:18:46 +05:30 committed by wangxiyuan
parent 69f526d6bd
commit ae24d85962
3 changed files with 6 additions and 11 deletions

View File

@ -64,13 +64,11 @@ def dynamic_conf(uri, options, conf=None):
driver_opts = utils.dict_to_conf({'message_store': storage_type})
conf.register_opts(driver_opts, group=u'drivers')
conf.set_override('message_store', storage_type, 'drivers',
enforce_type=True)
conf.set_override('message_store', storage_type, 'drivers')
for opt in options:
if opt in conf[storage_group]:
conf.set_override(opt, options[opt], group=storage_group,
enforce_type=True)
conf.set_override(opt, options[opt], group=storage_group)
return conf

View File

@ -110,7 +110,7 @@ class TestBase(testtools.TestCase):
test by the tearDown() method.
"""
for k, v in kw.items():
self.conf.set_override(k, v, group, enforce_type=True)
self.conf.set_override(k, v, group)
def _my_dir(self):
return os.path.abspath(os.path.dirname(__file__))

View File

@ -71,8 +71,7 @@ class BaseWalkMigrationTestCase(object):
"""
CONF.set_override('uri', str(engine.url),
group='drivers:management_store:sqlalchemy',
enforce_type=True)
group='drivers:management_store:sqlalchemy')
def _alembic_command(self, alembic_command, engine, *args, **kwargs):
"""Most of alembic command return data into output.
@ -81,8 +80,7 @@ class BaseWalkMigrationTestCase(object):
"""
self.ALEMBIC_CONFIG.stdout = buf = io.StringIO()
CONF.set_override('uri', str(engine.url),
group='drivers:management_store:sqlalchemy',
enforce_type=True)
group='drivers:management_store:sqlalchemy')
getattr(command, alembic_command)(*args, **kwargs)
res = buf.getvalue().strip()
@ -184,8 +182,7 @@ class TestModelsMigrationsSync(t_m.ModelsMigrationsSync):
def db_sync(self, engine):
CONF.set_override('uri', str(engine.url),
group='drivers:management_store:sqlalchemy',
enforce_type=True)
group='drivers:management_store:sqlalchemy')
script_location = os.path.join(self.mg_path, 'alembic_migrations')
self.ALEMBIC_CONFIG.set_main_option('script_location', script_location)
alembic.command.upgrade(self.ALEMBIC_CONFIG, 'head')