From f1137be2bc37808ed136ad9e2348054342fefdc1 Mon Sep 17 00:00:00 2001 From: Kyrylo Romanenko Date: Fri, 13 Jan 2017 18:07:04 +0200 Subject: [PATCH] Change tenant to project in docs and unit tests Change os_tenant_name to os_project_name in documentation, client and shell unit tests. This is follow-up change augmenting the patch https://review.openstack.org/#/c/408235/ for consistency. Change-Id: Iaea3ddc71dadc2991e56667988df82aa1cfaf525 Related-Bug: #1646837 --- README.rst | 2 +- doc/source/api_v1.rst | 2 +- doc/source/cli.rst | 4 ++-- ironicclient/tests/unit/test_client.py | 20 ++++++++++---------- ironicclient/tests/unit/test_shell.py | 22 ++++++++++++---------- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/README.rst b/README.rst index 6e3b88ce5..9b91d7c4b 100644 --- a/README.rst +++ b/README.rst @@ -49,7 +49,7 @@ the ``--os-tenant-name``, ``--os-username``, ``--os-password`` and ``--os-auth-url`` parameters, though it may be easier to set them as environment variables:: - $ export OS_TENANT_NAME=project + $ export OS_PROJECT_NAME=project $ export OS_USERNAME=user $ export OS_PASSWORD=pass $ export OS_AUTH_URL=http://auth.example.com:5000/v2.0 diff --git a/doc/source/api_v1.rst b/doc/source/api_v1.rst index ada700c67..cd5c866cf 100644 --- a/doc/source/api_v1.rst +++ b/doc/source/api_v1.rst @@ -68,7 +68,7 @@ To create a client, you can use the API like so:: >>> kwargs = {'os_username': 'name', >>> 'os_password': 'password', >>> 'os_auth_url': 'http://keystone.example.org:5000/', - >>> 'os_tenant_name': 'tenant'} + >>> 'os_project_name': 'project'} >>> ironic = client.get_client(1, **kwargs) Perform ironic operations diff --git a/doc/source/cli.rst b/doc/source/cli.rst index 8b14d2055..78f1ee3e0 100644 --- a/doc/source/cli.rst +++ b/doc/source/cli.rst @@ -30,8 +30,8 @@ environment variables:: $ export OS_USERNAME=user $ export OS_PASSWORD=password - $ export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b # or OS_TENANT_NAME - $ export OS_TENANT_NAME=project # or OS_TENANT_ID + $ export OS_PROJECT_ID=b363706f891f48019483f8bd6503c54b # or OS_PROJECT_NAME + $ export OS_PROJECT_NAME=project # or OS_PROJECT_ID $ export OS_AUTH_URL=http://auth.example.com:5000/v2.0 The command-line tool will attempt to reauthenticate using the provided diff --git a/ironicclient/tests/unit/test_client.py b/ironicclient/tests/unit/test_client.py index b601037be..36745ca13 100644 --- a/ironicclient/tests/unit/test_client.py +++ b/ironicclient/tests/unit/test_client.py @@ -68,7 +68,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_no_auth_token(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', @@ -78,7 +78,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_service_and_endpoint_type_defaults(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', @@ -90,7 +90,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_with_region_no_auth_token(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_region_name': 'REGIONONE', @@ -101,7 +101,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_no_url(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': '', @@ -114,7 +114,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_incorrect_auth_params(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_auth_url': 'http://localhost:35357/v2.0', } @@ -123,7 +123,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_with_api_version_latest(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', @@ -134,7 +134,7 @@ class ClientTest(utils.BaseTestCase): def test_get_client_with_api_version_numeric(self): kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', @@ -148,7 +148,7 @@ class ClientTest(utils.BaseTestCase): # Make sure we don't coincidentally succeed self.assertNotEqual(v1.DEFAULT_VER, version) kwargs = { - 'os_tenant_name': 'TENANT_NAME', + 'os_project_name': 'PROJECT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', @@ -237,7 +237,7 @@ class ClientTest(utils.BaseTestCase): passed_kwargs = { 'os_auth_url': 'http://localhost:35357/v3', 'os_region_name': 'REGIONONE', - 'os_tenant_name': 'TENANT', + 'os_project_name': 'PROJECT', 'os_username': 'user', 'os_password': '1234', 'os_project_domain_id': 'DEFAULT', @@ -246,7 +246,7 @@ class ClientTest(utils.BaseTestCase): expected_kwargs = { 'auth_url': 'http://localhost:35357/v3', 'project_id': None, - 'project_name': 'TENANT', + 'project_name': 'PROJECT', 'user_domain_id': 'DEFAULT', 'user_domain_name': None, 'project_domain_id': 'DEFAULT', diff --git a/ironicclient/tests/unit/test_shell.py b/ironicclient/tests/unit/test_shell.py index 42baaba05..0c48f4088 100644 --- a/ironicclient/tests/unit/test_shell.py +++ b/ironicclient/tests/unit/test_shell.py @@ -35,20 +35,20 @@ V3_URL = BASE_URL + '/v3' FAKE_ENV = {'OS_USERNAME': 'username', 'OS_PASSWORD': 'password', - 'OS_TENANT_NAME': 'tenant_name', + 'OS_PROJECT_NAME': 'project_name', 'OS_AUTH_URL': V2_URL} FAKE_ENV_KEYSTONE_V2 = { 'OS_USERNAME': 'username', 'OS_PASSWORD': 'password', - 'OS_TENANT_NAME': 'tenant_name', + 'OS_PROJECT_NAME': 'project_name', 'OS_AUTH_URL': V2_URL } FAKE_ENV_KEYSTONE_V3 = { 'OS_USERNAME': 'username', 'OS_PASSWORD': 'password', - 'OS_TENANT_NAME': 'tenant_name', + 'OS_PROJECT_NAME': 'project_name', 'OS_AUTH_URL': V3_URL, 'OS_USER_DOMAIN_ID': 'default', 'OS_PROJECT_DOMAIN_ID': 'default', @@ -56,7 +56,7 @@ FAKE_ENV_KEYSTONE_V3 = { FAKE_ENV_KEYSTONE_V2_TOKEN = { 'OS_AUTH_TOKEN': 'admin_token', - 'OS_TENANT_NAME': 'tenant_name', + 'OS_PROJECT_NAME': 'project_name', 'OS_AUTH_URL': V2_URL } @@ -163,11 +163,12 @@ class ShellTest(utils.BaseTestCase): self.shell, 'node-list') expected_kwargs = { 'ironic_url': '', 'os_auth_url': FAKE_ENV['OS_AUTH_URL'], - 'os_tenant_id': '', 'os_tenant_name': FAKE_ENV['OS_TENANT_NAME'], + 'os_tenant_id': '', 'os_tenant_name': '', 'os_username': FAKE_ENV['OS_USERNAME'], 'os_user_domain_id': '', 'os_user_domain_name': '', 'os_password': FAKE_ENV['OS_PASSWORD'], 'os_auth_token': '', 'os_project_id': '', - 'os_project_name': '', 'os_project_domain_id': '', + 'os_project_name': FAKE_ENV['OS_PROJECT_NAME'], + 'os_project_domain_id': '', 'os_project_domain_name': '', 'os_region_name': '', 'os_service_type': '', 'os_endpoint_type': '', 'os_cacert': None, 'os_cert': None, 'os_key': None, @@ -191,11 +192,12 @@ class ShellTest(utils.BaseTestCase): 'ironic_url': '', 'os_auth_url': FAKE_ENV_KEYSTONE_V2_TOKEN['OS_AUTH_URL'], 'os_tenant_id': '', - 'os_tenant_name': FAKE_ENV_KEYSTONE_V2_TOKEN['OS_TENANT_NAME'], + 'os_tenant_name': '', 'os_username': '', 'os_user_domain_id': '', 'os_user_domain_name': '', 'os_password': '', 'os_auth_token': FAKE_ENV_KEYSTONE_V2_TOKEN['OS_AUTH_TOKEN'], - 'os_project_id': '', 'os_project_name': '', + 'os_project_id': '', + 'os_project_name': FAKE_ENV_KEYSTONE_V2_TOKEN['OS_PROJECT_NAME'], 'os_project_domain_id': '', 'os_project_domain_name': '', 'os_region_name': '', 'os_service_type': '', 'os_endpoint_type': '', 'os_cacert': None, 'os_cert': None, @@ -255,8 +257,8 @@ class ShellTest(utils.BaseTestCase): class TestCase(testtools.TestCase): def set_fake_env(self, fake_env): - client_env = ('OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_ID', - 'OS_TENANT_NAME', 'OS_AUTH_URL', 'OS_REGION_NAME', + client_env = ('OS_USERNAME', 'OS_PASSWORD', 'OS_PROJECT_ID', + 'OS_PROJECT_NAME', 'OS_AUTH_URL', 'OS_REGION_NAME', 'OS_AUTH_TOKEN', 'OS_NO_CLIENT_AUTH', 'OS_SERVICE_TYPE', 'OS_ENDPOINT_TYPE', 'OS_CACERT', 'OS_CERT', 'OS_KEY')