Log an actual error message when failed to load new style credentials

It's hard to switch one's configuration to new options without knowing
what exactly goes wrong.

Change-Id: I302c596c9e27265b77b6ea41aaee4b4f9e884cfd
Related-Bug: #1661250
This commit is contained in:
Dmitry Tantsur 2017-02-03 11:46:42 +01:00
parent ac2b1a48ef
commit 04d8552721

View File

@ -17,8 +17,10 @@ import copy
from keystoneauth1 import exceptions as kaexception
from keystoneauth1 import loading as kaloading
from oslo_config import cfg
from oslo_log import log
LOG = log.getLogger(__name__)
LEGACY_SECTION = 'keystone_authtoken'
OLD_SESSION_OPTS = {
'certfile': [cfg.DeprecatedOpt('certfile', LEGACY_SECTION)],
@ -35,7 +37,9 @@ cfg.CONF.import_group(LEGACY_SECTION, 'keystonemiddleware.auth_token')
def load_auth(conf, group):
try:
auth = kaloading.load_auth_from_conf_options(conf, group)
except kaexception.MissingRequiredOptions:
except kaexception.MissingRequiredOptions as exc:
LOG.debug('Failed to load credentials from group %(grp)s: %(err)s',
{'grp': group, 'err': exc})
auth = None
return auth