Skip to content

Commit 88a6c1a

Browse files
committed
#84 Fix issue with checking ecs exec when aws guardduty is enabled, when it is enabled by default there is no managedAgents key, so array is null, and it results in jq: error (at <stdin>:175): Cannot iterate over null (null)
1 parent b31bb8c commit 88a6c1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

check-ecs-exec.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ if [[ "${executeCommandEnabled}" = "false" ]]; then
419419
else
420420
printf "\n"
421421
printf "${COLOR_DEFAULT} ----------\n"
422-
agentsStatus=$(echo "${describedTaskJson}" | jq -r ".tasks[0].containers[].managedAgents[].lastStatus")
422+
agentsStatus=$(echo "${describedTaskJson}" | jq -r ".tasks[0].containers[] | (.managedAgents // [])[] | .lastStatus")
423423
idx=0
424424
for _ in $agentsStatus; do
425425
containerName=$(echo "${describedTaskJson}" | jq -r ".tasks[0].containers[${idx}].name")

0 commit comments

Comments
 (0)