Skip to content

Commit

Permalink
#62 - fault-tolerant logic for validating execution role
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-khvostishkov committed Jul 25, 2024
1 parent b575135 commit 1a45feb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sagemaker_ssh_helper/sm-ssh-ide
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ elif [[ "$1" == "init-ssm" ]]; then
--user-profile-name "$(_print_sm_user_profile_name)" \
--output json \
| tr -d "\n")
execution_role=$(echo "$user_profile_json" | grep "ExecutionRole" \
execution_role=$(echo "$user_profile_json" | { grep "ExecutionRole" || true; } \
| sed -e 's/^.*"ExecutionRole": \"\([^"]*\)\".*$/\1/')

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

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

0 comments on commit 1a45feb

Please sign in to comment.