File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -124,11 +124,19 @@ callerIdentityJson=$(${AWS_CLI_BIN} sts get-caller-identity)
124
124
ACCOUNT_ID=$( echo " ${callerIdentityJson} " | jq -r " .Account" )
125
125
MY_IAM_ARN=$( echo " ${callerIdentityJson} " | jq -r " .Arn" )
126
126
127
- # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
127
+ # Check task existence
128
128
describedTaskJson=$( ${AWS_CLI_BIN} ecs describe-tasks \
129
129
--cluster " ${CLUSTER_NAME} " \
130
130
--tasks " ${TASK_ID} " \
131
131
--output json)
132
+ existTask=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].taskDefinitionArn" )
133
+ if [[ " x${existTask} " = " xnull" ]]; then
134
+ printf " ${COLOR_RED} Pre-flight check failed: The specified ECS task does not exist.\n\
135
+ Make sure the parameters you have specified for cluster \" ${CLUSTER_NAME} \" and task \" ${TASK_ID} \" are both valid.\n"
136
+ exit 1
137
+ fi
138
+
139
+ # Check whether the AWS CLI v1.19.28/v2.1.30 or later exists
132
140
executeCommandEnabled=$( echo " ${describedTaskJson} " | jq -r " .tasks[0].enableExecuteCommand" )
133
141
if [[ " x${executeCommandEnabled} " = " xnull" ]]; then
134
142
printf " ${COLOR_RED} Pre-flight check failed: ECS Exec requires the AWS CLI v1.19.28/v2.1.30 or later.\n\
You can’t perform that action at this time.
0 commit comments