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

@@ -1,6 +1,6 @@
{ {
"name": "bitlab S3 Backup", "name": "bitlab S3 Backup",
"version": "1.0.13", "version": "1.0.14",
"slug": "bitlab-s3-backup", "slug": "bitlab-s3-backup",
"description": "Sync Backups to bitlab S3 storage", "description": "Sync Backups to bitlab S3 storage",
"url": "https://git.bitlab.ch/bitlab/ha-addon", "url": "https://git.bitlab.ch/bitlab/ha-addon",

View File

@@ -2,7 +2,7 @@
# ============================================================================== # ==============================================================================
# Home Assistant Community Add-on: S3 Backup # Home Assistant Community Add-on: S3 Backup
# ============================================================================== # ==============================================================================
bashio::log.level "debug" bashio::log.level "info"
# script global shortcuts # 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` for I in `aws s3api list-objects-v2 --bucket "${bucket_name}" --endpoint-url "${custom_endpoint}" --region "${bucket_region}" --query 'Contents[*].Key' --output text`
do do
bashio::log.info "Checking object: $I" 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"` 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" bashio::log.info "Slug for object $I: $TAG"
if [ "$TAG" = "$delete_slug" ]; then 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 aws s3api delete-object --bucket "${bucket_name}" --endpoint-url "${custom_endpoint}" --region "${bucket_region}" --key "$I" --output text
fi fi
done done