Skip to content

Commit

Permalink
Merge pull request #266 from ImMin5/feature-service-accont-auto-sync
Browse files Browse the repository at this point in the history
Fix update project and project group logic
  • Loading branch information
ImMin5 authored Apr 18, 2024
2 parents d585b22 + e63909e commit 3b285a5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/spaceone/identity/service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,22 @@ def _create_project_group(
name = location_info["name"]
reference_id = location_info["resource_id"]

conditions = {
filter_params = {
"is_managed": True,
"reference_id": reference_id,
"domain_id": domain_id,
"workspace_id": workspace_id,
}
if parent_group_id:
conditions["parent_group_id"] = parent_group_id

project_group_vos = self.project_group_mgr.filter_project_groups(**conditions)
project_group_vos = self.project_group_mgr.filter_project_groups(
**filter_params
)

params = {
"trusted_account_id": trusted_account_id,
}
if parent_group_id:
params.update({"parent_group_id": parent_group_id})

if project_group_vos:
project_group_vo = project_group_vos[0]
Expand Down Expand Up @@ -594,11 +596,14 @@ def _create_project(
"is_managed": True,
}

project_vos = self.project_mgr.filter_projects(**params)
_LOGGER.debug(
f"[_create_service_account] project_vos: {name} {params} count: {len(project_vos)}"
)

if project_group_id:
params["project_group_id"] = project_group_id

project_vos = self.project_mgr.filter_projects(**params)

if project_vos:
project_vo = project_vos[0]
if project_vo.name != name:
Expand Down

0 comments on commit 3b285a5

Please sign in to comment.