diff options
author | Bertrand Souville <souville@docomolab-euro.com> | 2017-10-02 17:08:15 +0200 |
---|---|---|
committer | Gerald Kunzmann <kunzmann@docomolab-euro.com> | 2017-10-04 15:11:10 +0000 |
commit | 4b9d723b6e6e368536d43c8f511e6eeb35c7f27a (patch) | |
tree | 1d76b909c3142ae1924e3f47e5bccce6a2ebe180 | |
parent | 5698eda65d99786a9668bd00e49b5a158be90c35 (diff) |
Added support for Keystone v3
JIRA: PROMISE-80
Change-Id: I5e904da373e2d5309456a6ce7ec56e724a62791f
Signed-off-by: Bertrand Souville <souville@docomolab-euro.com>
(cherry picked from commit bd9acd199e55efc097443d8c99027cf0030b5e78)
-rw-r--r-- | promise/test/functest/run_promise_tests.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/promise/test/functest/run_promise_tests.py b/promise/test/functest/run_promise_tests.py index bb43e37..984b5cb 100644 --- a/promise/test/functest/run_promise_tests.py +++ b/promise/test/functest/run_promise_tests.py @@ -79,12 +79,6 @@ def main(): keystone_client = os_utils.get_keystone_client() - user_id = os_utils.get_user_id(keystone_client, creds['username']) - if user_id == '': - logger.error("Error : Failed to get id of %s user" % - creds['username']) - return return_code - logger.info("Creating project '%s'..." % PROMISE_PROJECT_NAME) project_id = os_utils.create_tenant( keystone_client, PROMISE_PROJECT_NAME, PROMISE_PROJECT_DESCRIPTION) @@ -94,7 +88,7 @@ def main(): return return_code logger.debug("Project '%s' created successfully." % PROMISE_PROJECT_NAME) - roles_name = ["admin", "Admin"] + roles_name = ["_member_", "Member"] role_id = '' for role_name in roles_name: if role_id == '': @@ -104,24 +98,32 @@ def main(): logger.error("Error : Failed to get id for %s role" % role_name) return return_code - logger.info("Adding role '%s' to project '%s'..." - % (role_id, PROMISE_PROJECT_NAME)) - if not os_utils.add_role_user(keystone_client, user_id, - role_id, project_id): - logger.error("Error : Failed to add %s on project %s" % - (creds['username'], PROMISE_PROJECT_NAME)) + domain_id = '' + domain_id = os.utils.get_domain_id(keystone_client, + os.environ["OS_USER_DOMAIN_NAME"]) + if domain_id == '': + logger.error("Error: Failed to get id for %s domain" % + os.environ["OS_USER_DOMAIN_NAME"]) return return_code - logger.debug("Role added successfully.") logger.info("Creating user '%s'..." % PROMISE_USER_NAME) - user_id = os_utils.create_user( - keystone_client, PROMISE_USER_NAME, PROMISE_USER_PWD, None, project_id) - - if not user_id: + try: + user = keystone_client.users.create(name=PROMISE_USER_NAME, + domain=domain_id, + password=PROMISE_USER_PWD) + except Exception as e: logger.error("Error : Failed to create %s user" % PROMISE_USER_NAME) return return_code logger.debug("User '%s' created successfully." % PROMISE_USER_NAME) + try: + keystone_client.roles.grant(role=role_id, user=user.id, + project=project_id) + except Exception as e: + logger.error("Error: Failed to grant member role on project %s" % + project_id) + return return_code + nova_client = os_utils.get_nova_client() glance_client = os_utils.get_glance_client() |