From 1a45feba34251e349bee1ebe0f653c92ff471e36 Mon Sep 17 00:00:00 2001 From: Ivan Khvostishkov <87804596+ivan-khvostishkov@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:40:13 +0200 Subject: [PATCH] #62 - fault-tolerant logic for validating execution role --- sagemaker_ssh_helper/sm-ssh-ide | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sagemaker_ssh_helper/sm-ssh-ide b/sagemaker_ssh_helper/sm-ssh-ide index 2c034b7..f1b52b1 100644 --- a/sagemaker_ssh_helper/sm-ssh-ide +++ b/sagemaker_ssh_helper/sm-ssh-ide @@ -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/') @@ -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/')