Skip to content

Commit

Permalink
Error handling around not retrieving command id
Browse files Browse the repository at this point in the history
Signed-off-by: Tanner Lewis <[email protected]>
  • Loading branch information
lewijacn committed Nov 21, 2024
1 parent 8d92881 commit 0c9a30c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/awsRunInitBootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c9a30c

Please sign in to comment.