From 49ea3d8589138e341017ee709fb87defe67950af Mon Sep 17 00:00:00 2001 From: Toni de la Fuente Date: Thu, 9 Dec 2021 12:19:45 +0100 Subject: [PATCH] Fix #940 handling error when can not list functions --- checks/check_extra760 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checks/check_extra760 b/checks/check_extra760 index 143ab96ec0..4e8cd9f0d0 100644 --- a/checks/check_extra760 +++ b/checks/check_extra760 @@ -31,7 +31,11 @@ extra760(){ fi for regx in $REGIONS; do - LIST_OF_FUNCTIONS=$($AWSCLI lambda list-functions $PROFILE_OPT --region $regx --query Functions[*].FunctionName --output text) + LIST_OF_FUNCTIONS=$($AWSCLI lambda list-functions $PROFILE_OPT --region $regx --query Functions[*].FunctionName --output text 2>&1) + if [[ $(echo "$LIST_OF_FUNCTIONS" | grep AccessDenied) ]]; then + textFail "$regx: Access Denied trying to list Lambda functions" "$regx" "$lambdafunction" + continue + fi if [[ $LIST_OF_FUNCTIONS ]]; then for lambdafunction in $LIST_OF_FUNCTIONS;do LAMBDA_FUNCTION_FOLDER="$SECRETS_TEMP_FOLDER/extra760-$lambdafunction-$regx"