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>
This commit is contained in:
nealalan
2022-04-07 09:57:29 -05:00
committed by GitHub
parent 734331d5bc
commit 4287b7ac61

View File

@@ -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')