Merge "Remove some deprecated options"

This commit is contained in:
Zuul 2021-07-06 16:09:35 +00:00 committed by Gerrit Code Review
commit 2def8382d9
4 changed files with 29 additions and 81 deletions

View File

@ -160,7 +160,7 @@ class ClientTest(utils.TestCase):
return client_args
@ddt.data(
{'auth_url': 'only_v3', 'api_key': 'password_backward_compat',
{'auth_url': 'only_v3', 'password': 'password_backward_compat',
'endpoint_type': 'publicURL', 'project_id': 'foo_tenant_project_id'},
{'password': 'renamed_api_key', 'endpoint_type': 'public',
'tenant_id': 'foo_tenant_project_id'},
@ -217,7 +217,7 @@ class ClientTest(utils.TestCase):
client.ks_client.Client.assert_called_with(
session=mock.ANY, version=(3, 0), auth_url='url_v3.0',
username=client_args['username'],
password=client_args.get('password', client_args.get('api_key')),
password=client_args.get('password'),
user_id=client_args['user_id'],
user_domain_name=client_args['user_domain_name'],
user_domain_id=client_args['user_domain_id'],
@ -233,7 +233,7 @@ class ClientTest(utils.TestCase):
mocked_ks_client.authenticate.assert_called_with()
@ddt.data(
{'auth_url': 'only_v2', 'api_key': 'foo', 'project_id': 'bar'},
{'auth_url': 'only_v2', 'password': 'foo', 'project_id': 'bar'},
{'password': 'foo', 'tenant_id': 'bar'},
)
def test_client_init_no_session_no_auth_token_v2(self, kwargs):
@ -271,7 +271,7 @@ class ClientTest(utils.TestCase):
client.ks_client.Client.assert_called_with(
session=mock.ANY, version=(2, 0), auth_url='url_v2.0',
username=client_args['username'],
password=client_args.get('password', client_args.get('api_key')),
password=client_args.get('password'),
tenant_id=client_args.get('tenant_id',
client_args.get('project_id')),
tenant_name=client_args['project_name'],

View File

@ -41,7 +41,10 @@ class Client(object):
Create an instance with your creds::
>>> client = Client(USERNAME, PASSWORD, PROJECT_ID, AUTH_URL)
>>> client = Client(username=USERNAME,
password=PASSWORD,
project_name=PROJECT_NAME,
auth_url=AUTH_URL)
Or, alternatively, you can create a client instance using the
keystoneauth1.session API::
@ -52,7 +55,7 @@ class Client(object):
>>> auth = v2.Password(auth_url=AUTH_URL,
username=USERNAME,
password=PASSWORD,
tenant_name=PROJECT_ID)
project_name=PROJECT_ID)
>>> sess = session.Session(auth=auth)
>>> manila = client.Client(VERSION, session=sess)
@ -61,24 +64,9 @@ class Client(object):
>>> client.shares.list()
...
"""
@removals.removed_kwarg(
'share_service_name', message="Please use 'service_name' instead",
removal_version='2.0.0')
@removals.removed_kwarg(
'proxy_tenant_id', message="This is not used anywhere",
removal_version='2.0.0')
@removals.removed_kwarg(
'proxy_token', message="This is not used anywhere",
removal_version='2.0.0')
@removals.removed_kwarg(
'os_cache', message="Please use 'use_keyring' instead",
removal_version='2.0.0')
@removals.removed_kwarg(
'api_key', message="Please use 'password' instead",
removal_version='2.0.0')
def __init__(self, username=None, api_key=None,
project_id=None, auth_url=None, insecure=False, timeout=None,
tenant_id=None, project_name=None, region_name=None,
def __init__(self, username=None, project_id=None, auth_url=None,
insecure=False, timeout=None, tenant_id=None,
project_name=None, region_name=None,
endpoint_type='publicURL', extensions=None,
service_type=constants.V1_SERVICE_TYPE, service_name=None,
retries=None, http_log_debug=False, input_auth_token=None,
@ -97,7 +85,7 @@ class Client(object):
**kwargs):
self.username = username
self.password = password or api_key
self.password = password
self.tenant_id = tenant_id or project_id
self.tenant_name = project_name
@ -121,8 +109,6 @@ class Client(object):
self.force_new_token = force_new_token
self.cached_token_lifetime = cached_token_lifetime
service_name = kwargs.get("share_service_name", service_name)
if input_auth_token and not service_catalog_url:
msg = ("For token-based authentication you should "
"provide 'input_auth_token' and 'service_catalog_url'.")
@ -214,21 +200,6 @@ class Client(object):
if extension.manager_class:
setattr(self, extension.name, extension.manager_class(self))
@removals.remove(
message="authenticate() method is deprecated. Client automatically "
"makes authentication call in the constructor.",
removal_version='2.0.0')
def authenticate(self):
"""Authenticate against the server.
Normally this is called automatically when you first access the API,
but you can call this method to force authentication right now.
Returns on success; raises :exc:`exceptions.Unauthorized` if the
credentials are wrong.
"""
pass
def _get_keystone_client(self):
# First create a Keystone session
if self.insecure:

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from debtcollector import removals
from keystoneauth1 import adapter
from keystoneauth1 import session
from keystoneclient import client as ks_client
@ -55,7 +53,10 @@ class Client(object):
Create an instance with your creds::
>>> client = Client(USERNAME, PASSWORD, PROJECT_ID, AUTH_URL)
>>> client = Client(username=USERNAME,
password=PASSWORD,
auth_url=AUTH_URL,
project_name=PROJECT_NAME)
Or, alternatively, you can create a client instance using the
keystoneauth1.session API::
@ -75,24 +76,9 @@ class Client(object):
>>> client.shares.list()
...
"""
@removals.removed_kwarg(
'share_service_name', message="Please use 'service_name' instead",
removal_version='2.0.0')
@removals.removed_kwarg(
'proxy_tenant_id', message="This is not used anywhere",
removal_version='2.0.0')
@removals.removed_kwarg(
'proxy_token', message="This is not used anywhere",
removal_version='2.0.0')
@removals.removed_kwarg(
'os_cache', message="Please use 'use_keyring' instead",
removal_version='2.0.0')
@removals.removed_kwarg(
'api_key', message="Please use 'password' instead",
removal_version='2.0.0')
def __init__(self, username=None, api_key=None,
project_id=None, auth_url=None, insecure=False, timeout=None,
tenant_id=None, project_name=None, region_name=None,
def __init__(self, username=None, project_id=None, auth_url=None,
insecure=False, timeout=None, tenant_id=None,
project_name=None, region_name=None,
endpoint_type='publicURL', extensions=None,
service_type=constants.V2_SERVICE_TYPE, service_name=None,
retries=None, http_log_debug=False, input_auth_token=None,
@ -111,7 +97,7 @@ class Client(object):
**kwargs):
self.username = username
self.password = password or api_key
self.password = password
self.tenant_id = tenant_id or project_id
self.tenant_name = project_name
@ -135,8 +121,6 @@ class Client(object):
self.force_new_token = force_new_token
self.cached_token_lifetime = cached_token_lifetime
service_name = kwargs.get("share_service_name", service_name)
if input_auth_token and not service_catalog_url:
msg = ("For token-based authentication you should "
"provide 'input_auth_token' and 'service_catalog_url'.")
@ -259,21 +243,6 @@ class Client(object):
if extension.manager_class:
setattr(self, extension.name, extension.manager_class(self))
@removals.remove(
message="authenticate() method is deprecated. Client automatically "
"makes authentication call in the constructor.",
removal_version='2.0.0')
def authenticate(self):
"""Authenticate against the server.
Normally this is called automatically when you first access the API,
but you can call this method to force authentication right now.
Returns on success; raises :exc:`exceptions.Unauthorized` if the
credentials are wrong.
"""
pass
def _get_keystone_client(self):
# First create a Keystone session
if self.insecure:

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
manilaclient SDK no longer supports some options that were deprecated in
version 2.0.0: 'share_service_name' (use 'service_name' instead),
'proxy_tenant_id', 'proxy_token', 'os_cache' (use 'use_keyring' instead)
'api_key'(use 'password' instead). The client.authenticate() method has
been removed as well, since authentication is performed automatically.