Skip to content

Commit 1a45feb

Browse files
#62 - fault-tolerant logic for validating execution role
1 parent b575135 commit 1a45feb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sagemaker_ssh_helper/sm-ssh-ide

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ elif [[ "$1" == "init-ssm" ]]; then
168168
--user-profile-name "$(_print_sm_user_profile_name)" \
169169
--output json \
170170
| tr -d "\n")
171-
execution_role=$(echo "$user_profile_json" | grep "ExecutionRole" \
171+
execution_role=$(echo "$user_profile_json" | { grep "ExecutionRole" || true; } \
172172
| sed -e 's/^.*"ExecutionRole": \"\([^"]*\)\".*$/\1/')
173173

174174
SSH_SSM_ROLE=$(echo "$execution_role" | sed -e 's/^.*:role\/\(.*\)/\1/')
@@ -177,7 +177,7 @@ elif [[ "$1" == "init-ssm" ]]; then
177177
domain_json=$(aws sagemaker describe-domain \
178178
--domain-id "$(_print_sm_domain_id)" \
179179
| tr -d "\n")
180-
execution_role=$(echo "$domain_json" | grep "ExecutionRole" \
180+
execution_role=$(echo "$domain_json" | { grep "ExecutionRole" || true; } \
181181
| sed -e 's/^.*"ExecutionRole": \"\([^"]*\)\".*$/\1/')
182182

183183
SSH_SSM_ROLE=$(echo "$execution_role" | sed -e 's/^.*:role\/\(.*\)/\1/')

0 commit comments

Comments
 (0)