summaryrefslogtreecommitdiff
path: root/keystonemiddleware/auth_token.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-12-01 23:58:38 +0000
committerGerrit Code Review <review@openstack.org>2014-12-01 23:58:38 +0000
commit2796974028d1baef358ebe2ccd3e9f40068502ea (patch)
tree88d5591930a18e290eab54c256dbebfd7bf1617c /keystonemiddleware/auth_token.py
parent6ae5b9580197d63dfdcd52f22f667b993d0adb81 (diff)
parentd72ce71fac7ae959bbe976be13a43181357379f4 (diff)
downloadkeystonemiddleware-2796974028d1baef358ebe2ccd3e9f40068502ea.tar.gz
Merge "Auth token supports deprecated names for paste conf options"
Diffstat (limited to 'keystonemiddleware/auth_token.py')
-rw-r--r--keystonemiddleware/auth_token.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/keystonemiddleware/auth_token.py b/keystonemiddleware/auth_token.py
index 54a1138..74c1f7c 100644
--- a/keystonemiddleware/auth_token.py
+++ b/keystonemiddleware/auth_token.py
@@ -468,20 +468,30 @@ def _conf_values_type_convert(conf):
"""Convert conf values into correct type."""
if not conf:
return {}
+
+ opt_types = {}
+ for o in _OPTS:
+ type_dest = (getattr(o, 'type', str), o.dest)
+ opt_types[o.dest] = type_dest
+ # Also add the deprecated name with the same type and dest.
+ for d_o in o.deprecated_opts:
+ opt_types[d_o.name] = type_dest
+
opts = {}
- opt_types = dict((o.dest, getattr(o, 'type', str)) for o in _OPTS)
for k, v in six.iteritems(conf):
+ dest = k
try:
- if v is None:
- opts[k] = v
- else:
- opts[k] = opt_types[k](v)
+ if v is not None:
+ type_, dest = opt_types[k]
+ v = type_(v)
except KeyError:
- opts[k] = v
+ # This option is not known to auth_token.
+ pass
except ValueError as e:
raise ConfigurationError(
_('Unable to convert the value of %(key)s option into correct '
'type: %(ex)s') % {'key': k, 'ex': e})
+ opts[dest] = v
return opts