Fixed using 'os_auth_ver' parameter when passed via --config

Although using 'os_auth_ver' parameter is deprecated, freezer-api (or
freezer-web-ui respectively) still uses it to generate configs for jobs.
Commit 50df2c8 introduced regression causing freezer-agent refusing to
start when config passed via '--config' contains 'os_auth_ver' parameter
(or any other deprecated option). The root cause is that loop (L568)
iterates through keys defined in config file passed via '--config'
therefore trying to call CONF.set_override with deprecated 'os_auth_ver'
as a first argument which causes oslo.config library to raise
KeyError: 'os-identity-api-version' as CONF.set_override is not expected
to be called with deprecated options. This simple patch adds call for
get for each key which may (correctly) raise NoSuchOptError for undefined
(and deprecated) keys, thus safely fallbacking to except routine.

Re-submitted.

Change-Id: Ia554d440b6256eab0f953ed9ad75cff1f040e6a1
This commit is contained in:
Jakub Jursa 2018-05-15 16:41:45 +02:00
parent 59974a2869
commit afbbaa2326
1 changed files with 1 additions and 0 deletions

View File

@ -566,6 +566,7 @@ def get_backup_args():
defaults.update(conf.default)
for config_key in conf.default.keys():
try:
CONF.get(config_key)
CONF.set_override(config_key, conf.default[config_key])
except NoSuchOptError:
LOG.debug('No such opt, {0}, so set it'.format(config_key))