Restict usage *args for novaclient.client.Client

Possitional arguments doen't allow to provide proper compatibility
and deprecation workflows. *args was deprecated long time ago and a
proper message was added.

Change-Id: Ib4a8f4db52a0f4cb8e8cf5e8c8e778eef8831e91
This commit is contained in:
Andrey Kurilin 2016-12-02 18:40:18 +02:00
parent c86a1eb3d7
commit 4ff6c617ec
2 changed files with 7 additions and 8 deletions

View File

@ -808,7 +808,7 @@ def get_client_class(version):
def Client(version, username=None, api_key=None, project_id=None,
auth_url=None, *args, **kwargs):
auth_url=None, **kwargs):
"""Initialize client object based on given version.
HOW-TO:
@ -829,15 +829,9 @@ def Client(version, username=None, api_key=None, project_id=None,
session API. See "The novaclient Python API" page at
python-novaclient's doc.
"""
if args:
warnings.warn("Only VERSION, USERNAME, PASSWORD, PROJECT_ID and "
"AUTH_URL arguments can be specified as positional "
"arguments. All other variables should be keyword "
"arguments. Note that this will become an error in "
"Ocata.")
api_version, client_class = _get_client_class_and_version(version)
kwargs.pop("direct_use", None)
return client_class(username=username, api_key=api_key,
project_id=project_id, auth_url=auth_url,
api_version=api_version, direct_use=False,
*args, **kwargs)
**kwargs)

View File

@ -0,0 +1,5 @@
---
upgrade:
- novaclient.client.Client entry-point accepts only 5 positional arguments(
version, username, api_key, project_id, auth_url). Using positional
arguments for all other options become an error.