Fix KeyError if a deprecated key is given

It happens when a deprecated key is given(i.e. os-auth-ver). The service shall
change the reference before calling oslo.config.

Change-Id: I841f027f90e353b7ea5e1ec059286e8fa9b94f49
Closes-Bug: #1774722
This commit is contained in:
Kent Wu 2018-06-16 19:09:01 -06:00
parent 9db8b7028e
commit c1499e54cd
1 changed files with 5 additions and 0 deletions

View File

@ -570,6 +570,11 @@ def get_backup_args():
except NoSuchOptError:
LOG.debug('No such opt, {0}, so set it'.format(config_key))
setattr(CONF, config_key, conf.default[config_key])
except KeyError:
real_opt, real_group = CONF._find_deprecated_opts(config_key)
if '-' in real_opt:
real_opt = real_opt.replace('-', '_')
CONF.set_override(real_opt, conf.default[real_opt])
if defaults['log_file']:
CONF.set_override('log_file', defaults['log_file'])