summaryrefslogtreecommitdiff
path: root/novaclient/client.py
diff options
context:
space:
mode:
authorAndrey Kurilin <akurilin@mirantis.com>2016-12-02 20:39:38 +0200
committerAndrey Kurilin <andr.kurilin@gmail.com>2016-12-15 19:49:04 +0200
commit9bbe5a87b7df62a7962debba5db7c96555da6761 (patch)
treeb35d299019b67bd189641e46cf214db2ad71b173 /novaclient/client.py
parent9df9aff6fc921e7d4b5439f6bde76384f1d31d2f (diff)
downloadpython-novaclient-9bbe5a87b7df62a7962debba5db7c96555da6761.tar.gz
Clarify meaning of project_id var
Meaning of project_id (argument of novaclient.client) was not clear. In different cases, it can be tenant/project id or name (in terms of Keystone). * tenant_id - this variable is deprecated now and project_id should be used instead; * project_id - meaning of this variable is clarified now and it expects Project ID (in terms of keystone) now. Change-Id: Ie3fc6b50260203c0debe8664bb87a7d72fb645d7
Diffstat (limited to 'novaclient/client.py')
-rw-r--r--novaclient/client.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/novaclient/client.py b/novaclient/client.py
index 4cc5db2e..8c85d495 100644
--- a/novaclient/client.py
+++ b/novaclient/client.py
@@ -693,13 +693,13 @@ def _construct_http_client(api_version=None,
os_cache=False,
password=None,
project_id=None,
+ project_name=None,
proxy_tenant_id=None,
proxy_token=None,
region_name=None,
service_name=None,
service_type='compute',
session=None,
- tenant_id=None,
timeout=None,
timings=False,
user_agent='python-novaclient',
@@ -728,8 +728,12 @@ def _construct_http_client(api_version=None,
return HTTPClient(username,
password,
user_id=user_id,
- projectid=project_id,
- tenant_id=tenant_id,
+ # NOTE(andreykurilin): HTTPClient will be replaced
+ # fully by SessionClient soon, so there are no
+ # reasons to spend time renaming projectid variable
+ # to tenant_name/project_name.
+ projectid=project_name,
+ tenant_id=project_id,
auth_url=auth_url,
auth_token=auth_token,
insecure=insecure,
@@ -873,6 +877,9 @@ def Client(version, username=None, password=None, project_id=None,
"""
if password:
kwargs["password"] = password
+ if project_id:
+ kwargs["project_id"] = project_id
+
_check_arguments(kwargs, "Ocata", "auth_plugin")
_check_arguments(kwargs, "Ocata", "auth_system")
if "no_cache" in kwargs:
@@ -899,12 +906,13 @@ def Client(version, username=None, password=None, project_id=None,
# allow additional arguments(kwargs), someone can use this variable name
# and face issue about unexpected behavior.
_check_arguments(kwargs, "Ocata", "interface", right_name="endpoint_type")
+ _check_arguments(kwargs, "Ocata", "tenant_name", right_name="project_name")
+ _check_arguments(kwargs, "Ocata", "tenant_id", right_name="project_id")
api_version, client_class = _get_client_class_and_version(version)
kwargs.pop("direct_use", None)
return client_class(api_version=api_version,
auth_url=auth_url,
direct_use=False,
- project_id=project_id,
username=username,
**kwargs)