mirror of
https://opendev.org/openstack/python-keystoneclient.git
synced 2026-01-16 23:10:41 +00:00
Remove debtcollector dependency
Instead of depending on a library, raise warnings directly. Most of these are in code that should have been removed multiple versions ago, in any case. Change-Id: I9761dbc2483df5b4ceced3de0e6a77ead5fdaa20 Signed-off-by: Aarni Koskela <akx@iki.fi>
This commit is contained in:
parent
d7e1949c20
commit
b7e61602f6
14 changed files with 150 additions and 129 deletions
|
|
@ -11,8 +11,8 @@
|
|||
# under the License.
|
||||
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from debtcollector import removals
|
||||
from keystoneauth1 import plugin
|
||||
import stevedore
|
||||
|
||||
|
|
@ -27,12 +27,12 @@ AUTH_INTERFACE = plugin.AUTH_INTERFACE
|
|||
PLUGIN_NAMESPACE = 'keystoneclient.auth.plugin'
|
||||
IDENTITY_AUTH_HEADER_NAME = 'X-Auth-Token'
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
DEPRECATED_MSG = (
|
||||
'keystoneclient auth plugins are deprecated. Use keystoneauth. '
|
||||
'Deprecated as of version 2.1.0, will be removed in version 3.0.0.'
|
||||
)
|
||||
|
||||
|
||||
def get_available_plugin_names():
|
||||
"""Get the names of all the plugins that are available on the system.
|
||||
|
||||
|
|
@ -42,16 +42,12 @@ def get_available_plugin_names():
|
|||
:returns: A list of names.
|
||||
:rtype: frozenset
|
||||
"""
|
||||
warnings.warn(DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
mgr = stevedore.ExtensionManager(namespace=PLUGIN_NAMESPACE,
|
||||
invoke_on_load=False)
|
||||
return frozenset(mgr.names())
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def get_available_plugin_classes():
|
||||
"""Retrieve all the plugin classes available on the system.
|
||||
|
||||
|
|
@ -59,6 +55,7 @@ def get_available_plugin_classes():
|
|||
class as the value.
|
||||
:rtype: dict
|
||||
"""
|
||||
warnings.warn(DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
mgr = stevedore.ExtensionManager(namespace=PLUGIN_NAMESPACE,
|
||||
propagate_map_exceptions=True,
|
||||
invoke_on_load=False)
|
||||
|
|
@ -66,11 +63,6 @@ def get_available_plugin_classes():
|
|||
return dict(mgr.map(lambda ext: (ext.entry_point.name, ext.plugin)))
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def get_plugin_class(name):
|
||||
"""Retrieve a plugin class by its entrypoint name.
|
||||
|
||||
|
|
@ -82,6 +74,7 @@ def get_plugin_class(name):
|
|||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||
created.
|
||||
"""
|
||||
warnings.warn(DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
try:
|
||||
mgr = stevedore.DriverManager(namespace=PLUGIN_NAMESPACE,
|
||||
name=name,
|
||||
|
|
|
|||
|
|
@ -12,17 +12,11 @@
|
|||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from keystoneclient.auth import base
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def register_argparse_arguments(parser, argv, default=None):
|
||||
"""Register CLI options needed to create a plugin.
|
||||
|
||||
|
|
@ -40,6 +34,7 @@ def register_argparse_arguments(parser, argv, default=None):
|
|||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||
created.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
in_parser = argparse.ArgumentParser(add_help=False)
|
||||
env_plugin = os.environ.get('OS_AUTH_PLUGIN', default)
|
||||
for p in (in_parser, parser):
|
||||
|
|
@ -65,11 +60,6 @@ def register_argparse_arguments(parser, argv, default=None):
|
|||
return plugin
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def load_from_argparse_arguments(namespace, **kwargs):
|
||||
"""Retrieve the created plugin from the completed argparse results.
|
||||
|
||||
|
|
@ -84,6 +74,7 @@ def load_from_argparse_arguments(namespace, **kwargs):
|
|||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||
created.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
if not namespace.os_auth_plugin:
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from keystoneclient.auth import base
|
||||
|
|
@ -21,11 +22,6 @@ _section_help = 'Config Section from which to load plugin specific options'
|
|||
_AUTH_SECTION_OPT = cfg.StrOpt('auth_section', help=_section_help)
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def get_common_conf_options():
|
||||
"""Get the oslo_config options common for all auth plugins.
|
||||
|
||||
|
|
@ -38,14 +34,10 @@ def get_common_conf_options():
|
|||
|
||||
:returns: A list of oslo_config options.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
return [_AUTH_PLUGIN_OPT, _AUTH_SECTION_OPT]
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def get_plugin_options(name):
|
||||
"""Get the oslo_config options for a specific plugin.
|
||||
|
||||
|
|
@ -54,14 +46,10 @@ def get_plugin_options(name):
|
|||
|
||||
:returns: A list of oslo_config options.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
return base.get_plugin_class(name).get_options()
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def register_conf_options(conf, group):
|
||||
"""Register the oslo_config options that are needed for a plugin.
|
||||
|
||||
|
|
@ -80,6 +68,7 @@ def register_conf_options(conf, group):
|
|||
:type conf: oslo_config.cfg.ConfigOpts
|
||||
:param string group: The ini group to register options in.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
conf.register_opt(_AUTH_SECTION_OPT, group=group)
|
||||
|
||||
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is
|
||||
|
|
@ -93,11 +82,6 @@ def register_conf_options(conf, group):
|
|||
conf.register_opt(_AUTH_PLUGIN_OPT, group=group)
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message='keystoneclient auth plugins are deprecated. Use keystoneauth.',
|
||||
version='2.1.0',
|
||||
removal_version='3.0.0'
|
||||
)
|
||||
def load_from_conf_options(conf, group, **kwargs):
|
||||
"""Load a plugin from an oslo_config CONF object.
|
||||
|
||||
|
|
@ -117,6 +101,7 @@ def load_from_conf_options(conf, group, **kwargs):
|
|||
:raises keystoneclient.exceptions.NoMatchingPlugin: if a plugin cannot be
|
||||
created.
|
||||
"""
|
||||
warnings.warn(base.DEPRECATED_MSG, DeprecationWarning, stacklevel=2)
|
||||
# NOTE(jamielennox): plugins are allowed to specify a 'section' which is
|
||||
# the group that auth options should be taken from. If not present they
|
||||
# come from the same as the base options were registered in.
|
||||
|
|
|
|||
|
|
@ -10,15 +10,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from keystoneclient import discover
|
||||
from keystoneclient import httpclient
|
||||
from keystoneclient import session as client_session
|
||||
|
||||
|
||||
@removals.remove(message='Use keystoneclient.httpclient.HTTPClient instead',
|
||||
version='1.7.0', removal_version='2.0.0')
|
||||
class HTTPClient(httpclient.HTTPClient):
|
||||
"""Deprecated alias for httpclient.HTTPClient.
|
||||
|
||||
|
|
@ -28,6 +26,15 @@ class HTTPClient(httpclient.HTTPClient):
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
warnings.warn(
|
||||
'Use keystoneclient.httpclient.HTTPClient instead. '
|
||||
'Deprecated in 1.7.0, to be removed in 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
super(HTTPClient, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
def Client(version=None, unstable=False, session=None, **kwargs):
|
||||
"""Factory function to create a new identity service client.
|
||||
|
|
|
|||
|
|
@ -23,10 +23,9 @@ import base64
|
|||
import errno
|
||||
import hashlib
|
||||
import logging
|
||||
import warnings
|
||||
import zlib
|
||||
|
||||
from debtcollector import removals
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.i18n import _
|
||||
|
||||
|
|
@ -319,14 +318,18 @@ def is_asn1_token(token):
|
|||
return token[:3] == PKI_ASN1_PREFIX
|
||||
|
||||
|
||||
@removals.remove(message='Use is_asn1_token() instead.', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def is_ans1_token(token):
|
||||
"""Deprecated.
|
||||
|
||||
This function is deprecated as of the 1.7.0 release in favor of
|
||||
:func:`is_asn1_token` and may be removed in the 2.0.0 release.
|
||||
"""
|
||||
warnings.warn(
|
||||
'Use is_asn1_token() instead. '
|
||||
'Deprecated as of version 1.7.0, will be removed in version 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return is_asn1_token(token)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
import warnings
|
||||
|
||||
from debtcollector import removals
|
||||
from keystoneauth1 import plugin
|
||||
|
||||
from keystoneclient import _discover
|
||||
|
|
@ -177,8 +176,6 @@ class Discover(_discover.Discover):
|
|||
super(Discover, self).__init__(session, url,
|
||||
authenticated=authenticated)
|
||||
|
||||
@removals.remove(message='Use raw_version_data instead.', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def available_versions(self, **kwargs):
|
||||
"""Return a list of identity APIs available on the server.
|
||||
|
||||
|
|
@ -201,12 +198,14 @@ class Discover(_discover.Discover):
|
|||
It is a direct representation of the layout presented by the
|
||||
identity API.
|
||||
"""
|
||||
warnings.warn(
|
||||
'Use raw_version_data instead. '
|
||||
'Deprecated in 1.7.0, to be removed in 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return self.raw_version_data(**kwargs)
|
||||
|
||||
@removals.removed_kwarg(
|
||||
'unstable',
|
||||
message='Use allow_experimental and allow_unknown instead.',
|
||||
version='1.7.0', removal_version='2.0.0')
|
||||
def raw_version_data(self, unstable=False, **kwargs):
|
||||
"""Get raw version information from URL.
|
||||
|
||||
|
|
@ -256,6 +255,13 @@ class Discover(_discover.Discover):
|
|||
'updated': '2013-03-06T00:00:00Z'}]
|
||||
"""
|
||||
if unstable:
|
||||
warnings.warn(
|
||||
"The 'unstable' argument is deprecated in 1.7.0 "
|
||||
"and may be removed in 2.0.0. Use 'allow_experimental' and "
|
||||
"'allow_unknown' instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
kwargs.setdefault('allow_experimental', True)
|
||||
kwargs.setdefault('allow_unknown', True)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
import logging
|
||||
import urllib.parse as urlparse
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient import httpclient
|
||||
|
|
@ -27,10 +26,6 @@ _logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
# NOTE(jamielennox): To be removed after Pike.
|
||||
@removals.removed_class('keystoneclient.generic.client.Client',
|
||||
message='Use keystoneauth discovery',
|
||||
version='3.9.0',
|
||||
removal_version='4.0.0')
|
||||
class Client(httpclient.HTTPClient):
|
||||
"""Client for the OpenStack Keystone pre-version calls API.
|
||||
|
||||
|
|
@ -55,6 +50,13 @@ class Client(httpclient.HTTPClient):
|
|||
|
||||
def __init__(self, endpoint=None, **kwargs):
|
||||
"""Initialize a new client for the Keystone v2.0 API."""
|
||||
warnings.warn(
|
||||
'keystoneclient.generic.client.Client is deprecated; '
|
||||
'use keystoneauth discovery instead. '
|
||||
'Deprecated in 3.9.0, to be removed in 4.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
super(Client, self).__init__(endpoint=endpoint, **kwargs)
|
||||
self.endpoint = endpoint
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ import importlib.metadata
|
|||
import logging
|
||||
import warnings
|
||||
|
||||
from debtcollector import removals
|
||||
from debtcollector import renames
|
||||
from keystoneauth1 import adapter
|
||||
from oslo_serialization import jsonutils
|
||||
import packaging.version
|
||||
|
|
@ -70,8 +68,6 @@ release.
|
|||
"""
|
||||
|
||||
|
||||
@removals.remove(message='Use keystoneclient.session.request instead.',
|
||||
version='1.7.0', removal_version='2.0.0')
|
||||
def request(*args, **kwargs):
|
||||
"""Make a request.
|
||||
|
||||
|
|
@ -79,6 +75,12 @@ def request(*args, **kwargs):
|
|||
:func:`keystoneclient.session.request` and may be removed in the
|
||||
2.0.0 release.
|
||||
"""
|
||||
warnings.warn(
|
||||
'Use keystoneclient.session.request instead. '
|
||||
'Deprecated as of version 1.7.0, will be removed in version 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return client_session.request(*args, **kwargs)
|
||||
|
||||
|
||||
|
|
@ -238,10 +240,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
|
||||
version = None
|
||||
|
||||
@renames.renamed_kwarg('tenant_name', 'project_name', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
@renames.renamed_kwarg('tenant_id', 'project_id', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def __init__(self, username=None, tenant_id=None, tenant_name=None,
|
||||
password=None, auth_url=None, region_name=None, endpoint=None,
|
||||
token=None, auth_ref=None, use_keyring=False,
|
||||
|
|
@ -252,6 +250,21 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
trust_id=None, session=None, service_name=None,
|
||||
interface='default', endpoint_override=None, auth=None,
|
||||
user_agent=USER_AGENT, connect_retries=None, **kwargs):
|
||||
if tenant_name is not None:
|
||||
warnings.warn(
|
||||
'The tenant_name parameter is deprecated as of the 1.7.0 '
|
||||
'release in favor of project_name and may be removed in the '
|
||||
'2.0.0 release.', DeprecationWarning)
|
||||
if project_name is None:
|
||||
project_name = tenant_name
|
||||
if tenant_id is not None:
|
||||
warnings.warn(
|
||||
'The tenant_id parameter is deprecated as of the 1.7.0 '
|
||||
'release in favor of project_id and may be removed in the '
|
||||
'2.0.0 release.', DeprecationWarning)
|
||||
if project_id is None:
|
||||
project_id = tenant_id
|
||||
|
||||
# set baseline defaults
|
||||
self.user_id = None
|
||||
self.username = None
|
||||
|
|
@ -733,7 +746,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
def serialize(self, entity):
|
||||
return jsonutils.dumps(entity)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def request(self, *args, **kwargs):
|
||||
"""Send an http request with the specified characteristics.
|
||||
|
||||
|
|
@ -747,6 +759,12 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
adapter so this function is no longer on the standard request path.
|
||||
This may be removed in the 2.0.0 release.
|
||||
"""
|
||||
warnings.warn(
|
||||
'This function is deprecated as of 1.7.0 '
|
||||
'and may be removed in 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self._request(*args, **kwargs)
|
||||
|
||||
def _request(self, *args, **kwargs):
|
||||
|
|
@ -760,6 +778,12 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
self.management_url and url and passing in method and
|
||||
any associated kwargs.
|
||||
"""
|
||||
warnings.warn(
|
||||
'This function is deprecated as of 1.7.0 '
|
||||
'and may be removed in 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
if not management:
|
||||
endpoint_filter = kwargs.setdefault('endpoint_filter', {})
|
||||
endpoint_filter.setdefault('interface', 'public')
|
||||
|
|
@ -767,7 +791,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
kwargs.setdefault('authenticated', None)
|
||||
return self._request(url, method, **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def get(self, url, **kwargs):
|
||||
"""Perform an authenticated GET request.
|
||||
|
||||
|
|
@ -784,7 +807,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
"""
|
||||
return self._cs_request(url, 'GET', **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def head(self, url, **kwargs):
|
||||
"""Perform an authenticated HEAD request.
|
||||
|
||||
|
|
@ -801,7 +823,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
"""
|
||||
return self._cs_request(url, 'HEAD', **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def post(self, url, **kwargs):
|
||||
"""Perform an authenticate POST request.
|
||||
|
||||
|
|
@ -818,7 +839,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
"""
|
||||
return self._cs_request(url, 'POST', **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def put(self, url, **kwargs):
|
||||
"""Perform an authenticate PUT request.
|
||||
|
||||
|
|
@ -835,7 +855,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
"""
|
||||
return self._cs_request(url, 'PUT', **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def patch(self, url, **kwargs):
|
||||
"""Perform an authenticate PATCH request.
|
||||
|
||||
|
|
@ -852,7 +871,6 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
|
|||
"""
|
||||
return self._cs_request(url, 'PATCH', **kwargs)
|
||||
|
||||
@removals.remove(version='1.7.0', removal_version='2.0.0')
|
||||
def delete(self, url, **kwargs):
|
||||
"""Perform an authenticate DELETE request.
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import time
|
|||
import urllib.parse
|
||||
import warnings
|
||||
|
||||
from debtcollector import removals
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
|
|
@ -658,8 +657,6 @@ class Session(object):
|
|||
auth = self._auth_required(auth, msg)
|
||||
return auth.get_headers(self, **kwargs)
|
||||
|
||||
@removals.remove(message='Use get_auth_headers instead.', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def get_token(self, auth=None):
|
||||
"""Return a token as provided by the auth plugin.
|
||||
|
||||
|
|
@ -682,6 +679,12 @@ class Session(object):
|
|||
:returns: A valid token.
|
||||
:rtype: string
|
||||
"""
|
||||
warnings.warn(
|
||||
'Use get_auth_headers instead. '
|
||||
'Deprecated as of 1.7.0, to be removed in 2.0.0.',
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return (self.get_auth_headers(auth) or {}).get('X-Auth-Token')
|
||||
|
||||
def get_endpoint(self, auth=None, **kwargs):
|
||||
|
|
|
|||
|
|
@ -716,8 +716,6 @@ class Deprecations(fixtures.Fixture):
|
|||
# exception.
|
||||
warnings.filterwarnings('error', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
self.addCleanup(warnings.resetwarnings)
|
||||
|
||||
def expect_deprecations(self):
|
||||
|
|
@ -725,19 +723,13 @@ class Deprecations(fixtures.Fixture):
|
|||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
|
||||
@contextlib.contextmanager
|
||||
def expect_deprecations_here(self):
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
yield
|
||||
warnings.resetwarnings()
|
||||
warnings.filterwarnings('error', category=DeprecationWarning,
|
||||
module='^keystoneclient\\.')
|
||||
warnings.filterwarnings('ignore', category=DeprecationWarning,
|
||||
module='^debtcollector\\.')
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from keystoneclient import base
|
||||
|
||||
|
||||
|
|
@ -35,11 +36,6 @@ class RegionManager(base.CrudManager):
|
|||
collection_key = 'regions'
|
||||
key = 'region'
|
||||
|
||||
@removals.removed_kwarg(
|
||||
'enabled',
|
||||
message='The enabled parameter is deprecated.',
|
||||
version='3.18.0',
|
||||
removal_version='4.0.0')
|
||||
def create(self, id=None, description=None, enabled=True,
|
||||
parent_region=None, **kwargs):
|
||||
"""Create a region.
|
||||
|
|
@ -58,6 +54,14 @@ class RegionManager(base.CrudManager):
|
|||
:rtype: :class:`keystoneclient.v3.regions.Region`
|
||||
|
||||
"""
|
||||
if enabled is not True:
|
||||
# The user set it to something other than the unused default?
|
||||
warnings.warn(
|
||||
"The 'enabled' parameter is deprecated in 3.18.0 "
|
||||
"and may be removed in 4.0.0.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return super(RegionManager, self).create(
|
||||
id=id, description=description, enabled=enabled,
|
||||
parent_region_id=base.getid(parent_region), **kwargs)
|
||||
|
|
@ -87,11 +91,6 @@ class RegionManager(base.CrudManager):
|
|||
return super(RegionManager, self).list(
|
||||
**kwargs)
|
||||
|
||||
@removals.removed_kwarg(
|
||||
'enabled',
|
||||
message='The enabled parameter is deprecated.',
|
||||
version='3.18.0',
|
||||
removal_version='4.0.0')
|
||||
def update(self, region, description=None, enabled=None,
|
||||
parent_region=None, **kwargs):
|
||||
"""Update a region.
|
||||
|
|
@ -109,6 +108,14 @@ class RegionManager(base.CrudManager):
|
|||
:rtype: :class:`keystoneclient.v3.regions.Region`
|
||||
|
||||
"""
|
||||
if enabled is not None:
|
||||
# The user set it to something other than the unused default?
|
||||
warnings.warn(
|
||||
"The 'enabled' parameter is deprecated in 3.18.0 "
|
||||
"and may be removed in 4.0.0.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return super(RegionManager, self).update(
|
||||
region_id=base.getid(region),
|
||||
description=description,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from debtcollector import removals
|
||||
import warnings
|
||||
|
||||
from keystoneclient import base
|
||||
from keystoneclient import exceptions
|
||||
|
|
@ -46,13 +46,21 @@ class InferenceRule(base.Resource):
|
|||
pass
|
||||
|
||||
|
||||
def _warn_deprecated(replacement_name):
|
||||
new_class_name = 'keystoneclient.v3.roles.InferenceRuleManager'
|
||||
msg = (
|
||||
f'Use {new_class_name}.{replacement_name} instead. '
|
||||
f'Deprecated as of 3.9.0, to be removed 4.0.0.'
|
||||
)
|
||||
warnings.warn(msg, DeprecationWarning, stacklevel=3)
|
||||
|
||||
|
||||
class RoleManager(base.CrudManager):
|
||||
"""Manager class for manipulating Identity roles."""
|
||||
|
||||
resource_class = Role
|
||||
collection_key = 'roles'
|
||||
key = 'role'
|
||||
deprecation_msg = 'keystoneclient.v3.roles.InferenceRuleManager'
|
||||
|
||||
def _role_grants_base_url(self, user, group, system, domain, project,
|
||||
use_inherit_extension):
|
||||
|
|
@ -389,33 +397,28 @@ class RoleManager(base.CrudManager):
|
|||
os_inherit_extension_inherited=os_inherit_extension_inherited,
|
||||
**kwargs)
|
||||
|
||||
@removals.remove(message='Use %s.create instead.' % deprecation_msg,
|
||||
version='3.9.0', removal_version='4.0.0')
|
||||
def create_implied(self, prior_role, implied_role, **kwargs):
|
||||
_warn_deprecated("create")
|
||||
return InferenceRuleManager(self.client).create(prior_role,
|
||||
implied_role)
|
||||
|
||||
@removals.remove(message='Use %s.delete instead.' % deprecation_msg,
|
||||
version='3.9.0', removal_version='4.0.0')
|
||||
def delete_implied(self, prior_role, implied_role, **kwargs):
|
||||
_warn_deprecated("delete")
|
||||
return InferenceRuleManager(self.client).delete(prior_role,
|
||||
implied_role)
|
||||
|
||||
@removals.remove(message='Use %s.get instead.' % deprecation_msg,
|
||||
version='3.9.0', removal_version='4.0.0')
|
||||
def get_implied(self, prior_role, implied_role, **kwargs):
|
||||
_warn_deprecated("get")
|
||||
return InferenceRuleManager(self.client).get(prior_role,
|
||||
implied_role)
|
||||
|
||||
@removals.remove(message='Use %s.check instead.' % deprecation_msg,
|
||||
version='3.9.0', removal_version='4.0.0')
|
||||
def check_implied(self, prior_role, implied_role, **kwargs):
|
||||
_warn_deprecated("check")
|
||||
return InferenceRuleManager(self.client).check(prior_role,
|
||||
implied_role)
|
||||
|
||||
@removals.remove(message='Use %s.list_inference_roles' % deprecation_msg,
|
||||
version='3.9.0', removal_version='4.0.0')
|
||||
def list_role_inferences(self, **kwargs):
|
||||
_warn_deprecated("list_inference_roles")
|
||||
return InferenceRuleManager(self.client).list_inference_roles()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,22 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from debtcollector import renames
|
||||
import warnings
|
||||
|
||||
from keystoneclient import base
|
||||
from keystoneclient import exceptions
|
||||
from keystoneclient.i18n import _
|
||||
|
||||
|
||||
def _warn_project_arg(default_project, project):
|
||||
warnings.warn(
|
||||
"The 'project' argument has been renamed to 'default_project'.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return default_project or project
|
||||
|
||||
|
||||
class User(base.Resource):
|
||||
"""Represents an Identity user.
|
||||
|
||||
|
|
@ -44,8 +53,6 @@ class UserManager(base.CrudManager):
|
|||
msg = _('Specify both a user and a group')
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
||||
@renames.renamed_kwarg('project', 'default_project', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def create(self, name, domain=None, project=None, password=None,
|
||||
email=None, description=None, enabled=True,
|
||||
default_project=None, **kwargs):
|
||||
|
|
@ -79,7 +86,10 @@ class UserManager(base.CrudManager):
|
|||
will be used.
|
||||
|
||||
"""
|
||||
default_project_id = base.getid(default_project) or base.getid(project)
|
||||
if project:
|
||||
default_project = _warn_project_arg(default_project, project)
|
||||
del project
|
||||
default_project_id = base.getid(default_project)
|
||||
user_data = base.filter_none(name=name,
|
||||
domain_id=base.getid(domain),
|
||||
default_project_id=default_project_id,
|
||||
|
|
@ -92,8 +102,6 @@ class UserManager(base.CrudManager):
|
|||
return self._post('/users', {'user': user_data}, 'user',
|
||||
log=not bool(password))
|
||||
|
||||
@renames.renamed_kwarg('project', 'default_project', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def list(self, project=None, domain=None, group=None, default_project=None,
|
||||
**kwargs):
|
||||
"""List users.
|
||||
|
|
@ -123,7 +131,10 @@ class UserManager(base.CrudManager):
|
|||
will be used.
|
||||
|
||||
"""
|
||||
default_project_id = base.getid(default_project) or base.getid(project)
|
||||
if project:
|
||||
default_project = _warn_project_arg(default_project, project)
|
||||
del project
|
||||
default_project_id = base.getid(default_project)
|
||||
if group:
|
||||
base_url = '/groups/%s' % base.getid(group)
|
||||
else:
|
||||
|
|
@ -148,8 +159,6 @@ class UserManager(base.CrudManager):
|
|||
return super(UserManager, self).get(
|
||||
user_id=base.getid(user))
|
||||
|
||||
@renames.renamed_kwarg('project', 'default_project', version='1.7.0',
|
||||
removal_version='2.0.0')
|
||||
def update(self, user, name=None, domain=None, project=None, password=None,
|
||||
email=None, description=None, enabled=None,
|
||||
default_project=None, **kwargs):
|
||||
|
|
@ -184,7 +193,10 @@ class UserManager(base.CrudManager):
|
|||
will be used.
|
||||
|
||||
"""
|
||||
default_project_id = base.getid(default_project) or base.getid(project)
|
||||
if project:
|
||||
default_project = _warn_project_arg(default_project, project)
|
||||
del project
|
||||
default_project_id = base.getid(default_project)
|
||||
user_data = base.filter_none(name=name,
|
||||
domain_id=base.getid(domain),
|
||||
default_project_id=default_project_id,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
# you find any incorrect lower bounds, let us know or propose a fix.
|
||||
pbr>=2.0.0 # Apache-2.0
|
||||
|
||||
debtcollector>=1.2.0 # Apache-2.0
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue