From 4287b7ac61507335ebff9b75927769318ccbb52a Mon Sep 17 00:00:00 2001 From: nealalan <17957975+nealalan@users.noreply.github.com> Date: Thu, 7 Apr 2022 09:57:29 -0500 Subject: [PATCH] check empty array in SECURITYGROUPS object (#1099) * check empty array in SECURITYGROUPS object Logic is only checking an object to see if it is null. This should be checking for the array in the object to see if it is empty. * Replace new conditional with the old one * Update check_extra75 Co-authored-by: Sergio Garcia <38561120+sergargar@users.noreply.github.com> --- checks/check_extra75 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/checks/check_extra75 b/checks/check_extra75 index df480c87..6f39aa54 100644 --- a/checks/check_extra75 +++ b/checks/check_extra75 @@ -34,7 +34,8 @@ extra75(){ textInfo "$regx: Access Denied trying to describe security groups" "$regx" continue fi - if [[ $SECURITYGROUPS == "null" ]]; then + if [[ $(echo "$SECURITYGROUPS" | jq '."SecurityGroups" | length') -eq 0 ]]; then + textInfo "$regx: No Security Groups found in $regx" "$regx" continue fi SECURITYGROUP_NAMES=$(echo $SECURITYGROUPS | jq '.SecurityGroups|map({(.GroupId): (.GroupName)})|add')