Fix ignored KSA adapter options

KSA adapter options have been registered but these have been unused.
Fix the ignored adapter options so that a few important options such
as valid_interfaces work.

Note that we can't use the native oslo_conf argument because
the current behavior of Connection class attempts to load these adapter
options from the "keystone" section, while there are actually
registered in "oslo_limits" section.

This effectively reverts 4a3c10b58e
because the same functionality can be now achieved by
the valid_interface option.

Related-Bug: 2105987
Change-Id: I038b805be85b9b16c8a1a9eeaa1c90f8f413cc97
This commit is contained in:
Takashi Kajinami
2025-04-23 22:45:50 +09:00
parent 5be2965266
commit f351266cba
4 changed files with 15 additions and 12 deletions

View File

@@ -40,9 +40,18 @@ def _get_keystone_connection():
CONF, group='oslo_limit')
session = loading.load_session_from_conf_options(
CONF, group='oslo_limit', auth=auth)
ksa_opts = loading.get_adapter_conf_options(
include_deprecated=False)
conn_kwargs = {}
for opt in ksa_opts:
if opt.dest != 'valid_interfaces':
conn_kwargs['identity_' + opt.dest] = getattr(
CONF.oslo_limit, opt.dest)
conn_kwargs['identity_interface'] = \
CONF.oslo_limit.valid_interfaces
_SDK_CONNECTION = connection.Connection(
session=session,
interface=CONF.oslo_limit.interface
**conn_kwargs
).identity
except (ksa_exceptions.NoMatchingPlugin,
ksa_exceptions.MissingRequiredOptions,

View File

@@ -43,11 +43,6 @@ _options = [
choices=['public', 'publicURL', 'internal', 'internalURL',
'admin', 'adminURL'],
help=_("The interface for endpoint discovery")),
cfg.StrOpt(
'interface',
default='public',
choices=['public', 'internal', 'admin'],
help=_("The interface used for communication with identity service.")),
]
_option_group = 'oslo_limit'

View File

@@ -1,6 +0,0 @@
---
features:
- |
Added option ``interface`` to ``[oslo_limit]`` section, introducing ability
to select interface for communicating with identity service for obtaining
limits.

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fix ignored keystoneauth adapter options such as valid_interfaces.