Merge "Restrict positional arguments for Client"

This commit is contained in:
Jenkins 2016-04-24 00:13:11 +00:00 committed by Gerrit Code Review
commit 445dadcaae

@ -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)