File tree 2 files changed +11
-5
lines changed
src/spaceone/identity/service
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ def _create_service_account(
581
581
trusted_secret_id : str ,
582
582
provider : str ,
583
583
sync_options : dict = None ,
584
- ) -> ServiceAccount :
584
+ ) -> Union [ ServiceAccount , None ] :
585
585
domain_id = project_vo .domain_id
586
586
workspace_id = project_vo .workspace_id
587
587
project_id = project_vo .project_id
@@ -630,7 +630,16 @@ def _create_service_account(
630
630
if secret_schema_id :
631
631
params ["schema_id" ] = secret_schema_id
632
632
633
- service_account_vo = self .service_account_mgr .create_service_account (params )
633
+ # When the same name exists, skip creating service account
634
+ try :
635
+ service_account_vo = self .service_account_mgr .create_service_account (
636
+ params
637
+ )
638
+ except ERROR_SAVE_UNIQUE_VALUES :
639
+ _LOGGER .error (
640
+ f"[_create_service_account] Skip => duplicate service account name. reference id: { reference_id } , { provider } { name } { domain_id } { workspace_id } "
641
+ )
642
+ return
634
643
635
644
if secret_data :
636
645
secret_mgr : SecretManager = self .locator .get_manager ("SecretManager" )
Original file line number Diff line number Diff line change @@ -373,10 +373,7 @@ def get_workspaces(
373
373
role_type = ["WORKSPACE_OWNER" , "WORKSPACE_MEMBER" ],
374
374
)
375
375
376
- for role_vo in role_vos :
377
- print (role_vo .to_dict ())
378
376
role_name_map = {role_vo .role_id : role_vo .name for role_vo in role_vos }
379
- print (role_name_map )
380
377
role_bindings_info_map = {rb .workspace_id : rb .to_dict () for rb in rb_vos }
381
378
382
379
workspaces_info = [workspace_vo .to_dict () for workspace_vo in workspace_vos ]
You can’t perform that action at this time.
0 commit comments