From b40d2d55b4e782fe2c10c297c4650b888ad01947 Mon Sep 17 00:00:00 2001 From: Bas de Bruijne Date: Wed, 18 Jan 2023 08:25:11 -0400 Subject: [PATCH] tempest cleanup - don't initialize admin id's Tempest cleanup gathers the project, user, and role id. Since commit a857880423, this info is collected but not used. In specific cases this method raises an error so it's better to remove it. Closes-bug: #2003125 Change-Id: Icd71a2962808628edb611257ac544f0277cde1f3 --- tempest/cmd/cleanup.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py index 0b96d9ef5a..a8a344a691 100644 --- a/tempest/cmd/cleanup.py +++ b/tempest/cmd/cleanup.py @@ -90,7 +90,6 @@ from oslo_serialization import jsonutils as json from tempest import clients from tempest.cmd import cleanup_service from tempest.common import credentials_factory as credentials -from tempest.common import identity from tempest import config from tempest.lib import exceptions @@ -140,11 +139,6 @@ class TempestCleanup(command.Command): self.dry_run_data = {} self.json_data = {} - self.admin_id = "" - self.admin_role_id = "" - self.admin_project_id = "" - self._init_admin_ids() - # available services self.project_associated_services = ( cleanup_service.get_project_associated_cleanup_services()) @@ -227,26 +221,6 @@ class TempestCleanup(command.Command): svc = service(self.admin_mgr, **kwargs) svc.run() - def _init_admin_ids(self): - pr_cl = self.admin_mgr.projects_client - rl_cl = self.admin_mgr.roles_v3_client - rla_cl = self.admin_mgr.role_assignments_client - us_cl = self.admin_mgr.users_v3_client - - project = identity.get_project_by_name(pr_cl, - CONF.auth.admin_project_name) - self.admin_project_id = project['id'] - user = identity.get_user_by_project(us_cl, rla_cl, - self.admin_project_id, - CONF.auth.admin_username) - self.admin_id = user['id'] - - roles = rl_cl.list_roles()['roles'] - for role in roles: - if role['name'] == CONF.identity.admin_role: - self.admin_role_id = role['id'] - break - def get_parser(self, prog_name): parser = super(TempestCleanup, self).get_parser(prog_name) parser.add_argument('--init-saved-state', action="store_true",