From 031b67566b76d81a81bbd3de8fae42ee060f4596 Mon Sep 17 00:00:00 2001 From: Juan Abia Date: Mon, 16 May 2022 12:22:32 +0200 Subject: [PATCH] scheduled-cloud-cleaner: remove storage account skip scheduled cloud cleaner is skipping the default storage account for a resource group, as this images should get removed. There can be a situation where this images are not removed and forgotten here. Remove this skip condition so scc checks also in this storage account. --- schutzbot/scheduled_cloud_cleaner.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/schutzbot/scheduled_cloud_cleaner.sh b/schutzbot/scheduled_cloud_cleaner.sh index c1963e50e..abb92fac8 100755 --- a/schutzbot/scheduled_cloud_cleaner.sh +++ b/schutzbot/scheduled_cloud_cleaner.sh @@ -69,12 +69,8 @@ STORAGE_ACCOUNT_COUNT=$(echo "$STORAGE_ACCOUNT_LIST" | jq .[].name | wc -l) DELETE_TIME=$(date -d "- $HOURS_BACK hours" +%s) for i in $(seq 0 $(("$STORAGE_ACCOUNT_COUNT"-1))); do STORAGE_ACCOUNT_NAME=$(echo "$STORAGE_ACCOUNT_LIST" | jq .["$i"].name | tr -d '"') - if [ "$AZURE_STORAGE_ACCOUNT" = "$STORAGE_ACCOUNT_NAME" ]; then - echo "Not checking default storage account $AZURE_STORAGE_ACCOUNT in other storage account script." - continue - fi - echo "Checking storage account $STORAGE_ACCOUNT_NAME for old blobs." + CONTAINER_LIST=$(az storage container list --account-name "$STORAGE_ACCOUNT_NAME") CONTAINER_COUNT=$(echo "$CONTAINER_LIST" | jq .[].name | wc -l) for i2 in $(seq 0 $(("$CONTAINER_COUNT"-1))); do