This commit is contained in:
2024-04-03 14:33:36 +02:00
parent d24d19d70f
commit b7e6396ff4
2 changed files with 4 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
# ==============================================================================
# Home Assistant Community Add-on: S3 Backup
# ==============================================================================
bashio::log.level "debug"
bashio::log.level "info"
# script global shortcuts
@@ -34,10 +34,11 @@ function delete-s3-backup {
for I in `aws s3api list-objects-v2 --bucket "${bucket_name}" --endpoint-url "${custom_endpoint}" --region "${bucket_region}" --query 'Contents[*].Key' --output text`
do
bashio::log.info "Checking object: $I"
TAG=""
TAG=`aws s3api get-object-tagging --bucket "${bucket_name}" --endpoint-url "${custom_endpoint}" --region "${bucket_region}" --key "$I" --output text --query "TagSet[?Key=='slug'].Value"`
bashio::log.info "Slug for object $I: $TAG"
if [ "$TAG" = "$delete_slug" ]; then
bashio::log.info "Deleting object: $I"
bashio::log.info "Deleting object: $I TAG=$TAG delete_slug=$delete_slug"
aws s3api delete-object --bucket "${bucket_name}" --endpoint-url "${custom_endpoint}" --region "${bucket_region}" --key "$I" --output text
fi
done