From 0c9a30c006c4dfeaf792163f428d30fcee9816d1 Mon Sep 17 00:00:00 2001 From: Tanner Lewis Date: Thu, 21 Nov 2024 16:46:02 -0600 Subject: [PATCH] Error handling around not retrieving command id Signed-off-by: Tanner Lewis --- test/awsRunInitBootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/awsRunInitBootstrap.sh b/test/awsRunInitBootstrap.sh index 8d4f2b266..644b31acc 100755 --- a/test/awsRunInitBootstrap.sh +++ b/test/awsRunInitBootstrap.sh @@ -39,8 +39,13 @@ execute_command_and_wait_for_result() { local command="$1" local instance_id="$2" echo "Executing command: [$command] on node: $instance_id" + sleep 5 command_id=$(aws ssm send-command --instance-ids "$instance_id" --document-name "AWS-RunShellScript" --parameters commands="$command" --output text --query 'Command.CommandId') - sleep 10 + if [[ -z "$command_id" ]]; then + echo "Error: Unable to retrieve command id from triggered SSM command" + exit 1 + fi + sleep 5 command_status=$(aws ssm get-command-invocation --command-id "$command_id" --instance-id "$instance_id" --output text --query 'Status') max_attempts=25 attempt_count=0