Move auth token opts calculation into auth_token
The list of all auth token opts is currently calculated in opts.py. That module is included in auth_token/__init__.py, which in turn owns some opts that are needed by the former. This creates a circular import dependency. In order to fix such situation, this patch proposes to move the auth token opts calculation into auth_token/__init__.py, so that it will no longer need opts.py. Co-Authored-By: Alfredo Moralejo <amoralej@redhat.com> Closes-Bug: #1591913 Change-Id: If67d8bdb68a5ab9c07b960ad0111e2310ad82c83
This commit is contained in:
parent
1c3eafbb1f
commit
cc58b62f11
@ -207,6 +207,7 @@ object is stored.
|
||||
"""
|
||||
|
||||
import binascii
|
||||
import copy
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
@ -228,11 +229,11 @@ from keystonemiddleware.auth_token import _base
|
||||
from keystonemiddleware.auth_token import _cache
|
||||
from keystonemiddleware.auth_token import _exceptions as ksm_exceptions
|
||||
from keystonemiddleware.auth_token import _identity
|
||||
from keystonemiddleware.auth_token import _opts
|
||||
from keystonemiddleware.auth_token import _request
|
||||
from keystonemiddleware.auth_token import _revocations
|
||||
from keystonemiddleware.auth_token import _signing_dir
|
||||
from keystonemiddleware.auth_token import _user_plugin
|
||||
from keystonemiddleware import opts
|
||||
from keystonemiddleware.i18n import _, _LC, _LE, _LI, _LW
|
||||
|
||||
|
||||
@ -240,6 +241,36 @@ _LOG = logging.getLogger(__name__)
|
||||
_CACHE_INVALID_INDICATOR = 'invalid'
|
||||
|
||||
|
||||
AUTH_TOKEN_OPTS = [
|
||||
(_base.AUTHTOKEN_GROUP,
|
||||
_opts._OPTS + _auth.OPTS + loading.get_auth_common_conf_options())
|
||||
]
|
||||
|
||||
|
||||
def list_opts():
|
||||
"""Return a list of oslo_config options available in auth_token middleware.
|
||||
|
||||
The returned list includes all oslo_config options which may be registered
|
||||
at runtime by the project.
|
||||
|
||||
Each element of the list is a tuple. The first element is the name of the
|
||||
group under which the list of elements in the second element will be
|
||||
registered. A group name of None corresponds to the [DEFAULT] group in
|
||||
config files.
|
||||
|
||||
NOTE: This function is no longer used for oslo_config sample generation.
|
||||
Some services rely on this function for listing ALL (including deprecated)
|
||||
options and registering them into their own config objects which we do not
|
||||
want for sample config files.
|
||||
|
||||
See: :py:func:`keystonemiddleware.auth_token._opts.list_opts` for sample
|
||||
config files.
|
||||
|
||||
:returns: a list of (group_name, opts) tuples
|
||||
"""
|
||||
return [(g, copy.deepcopy(o)) for g, o in AUTH_TOKEN_OPTS]
|
||||
|
||||
|
||||
class _BIND_MODE(object):
|
||||
DISABLED = 'disabled'
|
||||
PERMISSIVE = 'permissive'
|
||||
@ -464,7 +495,7 @@ class AuthProtocol(BaseAuthProtocol):
|
||||
|
||||
self._conf = config.Config('auth_token',
|
||||
_base.AUTHTOKEN_GROUP,
|
||||
opts.list_auth_token_opts(),
|
||||
list_opts(),
|
||||
conf)
|
||||
|
||||
super(AuthProtocol, self).__init__(
|
||||
|
@ -16,39 +16,8 @@ __all__ = (
|
||||
'list_auth_token_opts',
|
||||
)
|
||||
|
||||
import copy
|
||||
|
||||
from keystoneauth1 import loading
|
||||
|
||||
from keystonemiddleware.auth_token import _auth
|
||||
from keystonemiddleware.auth_token import _base
|
||||
from keystonemiddleware.auth_token import _opts
|
||||
|
||||
auth_token_opts = [
|
||||
(_base.AUTHTOKEN_GROUP,
|
||||
_opts._OPTS + _auth.OPTS + loading.get_auth_common_conf_options())
|
||||
]
|
||||
from keystonemiddleware import auth_token
|
||||
|
||||
|
||||
def list_auth_token_opts():
|
||||
"""Return a list of oslo_config options available in auth_token middleware.
|
||||
|
||||
The returned list includes all oslo_config options which may be registered
|
||||
at runtime by the project.
|
||||
|
||||
Each element of the list is a tuple. The first element is the name of the
|
||||
group under which the list of elements in the second element will be
|
||||
registered. A group name of None corresponds to the [DEFAULT] group in
|
||||
config files.
|
||||
|
||||
NOTE: This function is no longer used for oslo_config sample generation.
|
||||
Some services rely on this function for listing ALL (including deprecated)
|
||||
options and registering them into their own config objects which we do not
|
||||
want for sample config files.
|
||||
|
||||
See: :py:func:`keystonemiddleware.auth_token._opts.list_opts` for sample
|
||||
config files.
|
||||
|
||||
:returns: a list of (group_name, opts) tuples
|
||||
"""
|
||||
return [(g, copy.deepcopy(o)) for g, o in auth_token_opts]
|
||||
return auth_token.list_opts()
|
||||
|
Loading…
Reference in New Issue
Block a user