File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -3554,12 +3554,12 @@ def get_caller_identity_arn(self):
3554
3554
user_profile_desc = self .sagemaker_client .describe_user_profile (
3555
3555
DomainId = domain_id , UserProfileName = user_profile_name
3556
3556
)
3557
- if (
3558
- user_profile_desc .get ("UserSettings" ) is not None
3559
- and "ExecutionRole" in user_profile_desc .get ("UserSettings" ).keys ()
3560
- ):
3557
+
3558
+ # First, try to find role in userSettings
3559
+ if user_profile_desc .get ("UserSettings" , {}).get ("ExecutionRole" , None ):
3561
3560
return user_profile_desc ["UserSettings" ]["ExecutionRole" ]
3562
3561
3562
+ # If not found, fallback to the domain
3563
3563
domain_desc = self .sagemaker_client .describe_domain (DomainId = domain_id )
3564
3564
return domain_desc ["DefaultUserSettings" ]["ExecutionRole" ]
3565
3565
except ClientError :
You can’t perform that action at this time.
0 commit comments