Skip to content

Commit

Permalink
fix: fix delete workspace error when service account doesn't exist
Browse files Browse the repository at this point in the history
Signed-off-by: ImMin5 <[email protected]>
  • Loading branch information
ImMin5 committed Apr 19, 2024
1 parent e63909e commit 8e4b2c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/spaceone/identity/service/workspace_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, *args, **kwargs):
self.domain_mgr = DomainManager()
self.resource_mgr = ResourceManager()
self.workspace_mgr = WorkspaceManager()
self.service_account_mgr = ServiceAccountManager()

@transaction(permission="identity:Workspace.write", role_types=["DOMAIN_ADMIN"])
@convert_model
Expand Down Expand Up @@ -102,13 +103,13 @@ def delete(self, params: WorkspaceDeleteRequest) -> None:
# Check is managed resource
self.resource_mgr.check_is_managed_resource_by_trusted_account(workspace_vo)

service_account_vos = self.workspace_mgr.filter_workspaces(
service_account_vos = self.service_account_mgr.filter_service_accounts(
domain_id=domain_id, workspace_id=workspace_id
)

if params.force:
self._delete_related_resources_in_workspace(workspace_vo)
elif service_account_vos.count() > 0:
elif len(service_account_vos) > 0:
raise ERROR_UNKNOWN(
message=f"Please delete service accounts in workspace ({workspace_id})"
)
Expand Down

0 comments on commit 8e4b2c4

Please sign in to comment.