summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-02-15 17:18:42 +0000
committerGerrit Code Review <review@openstack.org>2016-02-15 17:18:42 +0000
commit2dedc1cc98758621d43980ca893f6b057dc48b7b (patch)
tree7b6edf67cdfb6c5a0b78f2bb6fdea7b6b7e2aafe
parentad69caba780ebf18d4ec8bc52bffc615aec5f92d (diff)
parentee5e6ccd3d8b709415e571a2f86ba7da612d7338 (diff)
downloadkeystonemiddleware-2dedc1cc98758621d43980ca893f6b057dc48b7b.tar.gz
Merge "Use load_from_options_getter for auth plugins"4.3.0
-rw-r--r--keystonemiddleware/auth_token/__init__.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/keystonemiddleware/auth_token/__init__.py b/keystonemiddleware/auth_token/__init__.py
index 5b8b87b..6b94b54 100644
--- a/keystonemiddleware/auth_token/__init__.py
+++ b/keystonemiddleware/auth_token/__init__.py
@@ -954,18 +954,10 @@ class AuthProtocol(BaseAuthProtocol):
self._identity_server.fetch_ca_cert())
def _get_auth_plugin(self):
- # NOTE(jamielennox): Ideally this would use get_from_conf_options
+ # NOTE(jamielennox): Ideally this would use load_from_conf_options
# however that is not possible because we have to support the override
- # pattern we use in _conf_get. There is a somewhat replacement for this
- # in keystoneclient in load_from_options_getter which should be used
- # when available. Until then this is essentially a copy and paste of
- # the ksc load_from_conf_options code because we need to get a fix out
- # for this quickly.
-
- # FIXME(jamielennox): update to use load_from_options_getter when
- # https://review.openstack.org/162529 merges.
-
- # !!! - UNDER NO CIRCUMSTANCES COPY ANY OF THIS CODE - !!!
+ # pattern we use in _conf_get. This function therefore does a manual
+ # version of load_from_conf_options with the fallback plugin inline.
group = self._conf_get('auth_section') or _base.AUTHTOKEN_GROUP
@@ -991,20 +983,16 @@ class AuthProtocol(BaseAuthProtocol):
group=group)
)
+ # Plugin option registration is normally done as part of the load_from
+ # function rather than the register function so copy here.
plugin_loader = loading.get_plugin_loader(plugin_name)
- plugin_opts = [o._to_oslo_opt() for o in plugin_loader.get_options()]
- plugin_kwargs = dict()
+ plugin_opts = loading.get_auth_plugin_conf_options(plugin_loader)
(self._local_oslo_config or CONF).register_opts(plugin_opts,
group=group)
- for opt in plugin_opts:
- val = self._conf_get(opt.dest, group=group)
- if val is not None:
- val = opt.type(val)
- plugin_kwargs[opt.dest] = val
-
- return plugin_loader.load_from_options(**plugin_kwargs)
+ getter = lambda opt: self._conf_get(opt.dest, group=group)
+ return plugin_loader.load_from_options_getter(getter)
def _determine_project(self):
"""Determine a project name from all available config sources.