Fix logging.

This commit is contained in:
Alex Manning 2023-10-24 18:33:12 +01:00
parent 2bd31b8736
commit 0a7f40c8d0
2 changed files with 5 additions and 5 deletions

View file

@ -1,5 +1,5 @@
name: "Minio Backup" name: "Minio Backup"
version: "0.0.5" version: "0.0.6"
slug: minio-backup slug: minio-backup
description: >- description: >-
"Backup the backup folder using minio." "Backup the backup folder using minio."

View file

@ -33,20 +33,20 @@ def main():
found = client.bucket_exists(config["minio_bucket"]) found = client.bucket_exists(config["minio_bucket"])
if not found: if not found:
logger.warn("Creating bucket %s", config["minio_bucket"]) logger.warning("Creating bucket %s", config["minio_bucket"])
client.make_bucket(config["minio_bucket"]) client.make_bucket(config["minio_bucket"])
else: else:
logger.info("Bucket %s already exists.", config["minio_bucket"]) logger.info("Bucket %s already exists.", config["minio_bucket"])
backup_folder = pathlib.Path("/backup") backup_folder = pathlib.Path("/backup")
backup_files = backup_folder.iterdir() backup_files = list(backup_folder.iterdir())
logger.info("Found the folllowing files in /backup: %s", backup_files) logger.info("Found the folllowing files in /backup: %s", backup_files)
objects = [x.object_name for x in client.list_objects(config["minio_bucket"])] objects = [x.object_name for x in client.list_objects(config["minio_bucket"])]
logger.info("Found the following files in s3: %s", objects) logger.info("Found the following files in s3: %s", objects)
to_upload = [x for x in backup_folder.iterdir() if x.name not in objects] to_upload = [x for x in backup_folder.iterdir() if x.name not in objects]
logger.warn( logger.warning(
"The following files do not already exist and will be backed up: %s", to_upload "The following files do not already exist and will be backed up: %s", to_upload
) )
@ -56,7 +56,7 @@ def main():
file.name, file.name,
str(file.resolve()), str(file.resolve()),
) )
logger.warn("Uploaded %s", file.name) logger.warning("Uploaded %s", file.name)
logger.info("Done") logger.info("Done")