diff options
author | Andrey Kurilin <akurilin@mirantis.com> | 2016-04-15 12:31:26 +0300 |
---|---|---|
committer | Andrey Kurilin <akurilin@mirantis.com> | 2016-04-19 12:39:12 +0300 |
commit | 2a72b86cd11605808a936024cf7093e01cf1d46e (patch) | |
tree | 28f4276f86848f6d968d4b2673c73cd76ff4712c /novaclient | |
parent | f6efc861b7b40c8a78743fed661053506fb1301a (diff) | |
download | python-novaclient-2a72b86cd11605808a936024cf7093e01cf1d46e.tar.gz |
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
Diffstat (limited to 'novaclient')
-rw-r--r-- | novaclient/client.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/novaclient/client.py b/novaclient/client.py index 5fa7060d..f2143d68 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -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) |