Restrict positional arguments for Client
It is hard to deprecate or remove arguments for Client objects. We already have several args which are not used anywhere and we need to do something with them(clean code). Change-Id: I2218ff0c750922a105d21a13e42f193ffd86ec01
This commit is contained in:
parent
f6efc861b7
commit
2a72b86cd1
@ -809,7 +809,8 @@ def get_client_class(version):
|
||||
return client_class
|
||||
|
||||
|
||||
def Client(version, *args, **kwargs):
|
||||
def Client(version, username=None, api_key=None, project_id=None,
|
||||
auth_url=None, *args, **kwargs):
|
||||
"""Initialize client object based on given version.
|
||||
|
||||
HOW-TO:
|
||||
@ -830,7 +831,15 @@ def Client(version, *args, **kwargs):
|
||||
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(api_version=api_version, direct_use=False,
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user