Lay groundwork for checking size in s3 is right.
This commit is contained in:
parent
0a7f40c8d0
commit
e7749d226f
2 changed files with 12 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
name: "Minio Backup"
|
||||
version: "0.0.6"
|
||||
version: "0.0.7"
|
||||
slug: minio-backup
|
||||
description: >-
|
||||
"Backup the backup folder using minio."
|
||||
|
|
|
@ -42,10 +42,18 @@ def main():
|
|||
backup_files = list(backup_folder.iterdir())
|
||||
logger.info("Found the folllowing files in /backup: %s", backup_files)
|
||||
|
||||
objects = [x.object_name for x in client.list_objects(config["minio_bucket"])]
|
||||
logger.info("Found the following files in s3: %s", objects)
|
||||
objects = client.list_objects(config["minio_bucket"])
|
||||
object_names = [x.object_name for x in objects]
|
||||
logger.info("Found the following files in s3: %s", object_names)
|
||||
|
||||
to_upload = []
|
||||
for file in backup_files:
|
||||
if file.name in object_names:
|
||||
logger.info("File %s already exists in s3", file.name)
|
||||
continue
|
||||
else:
|
||||
to_upload.append(file)
|
||||
|
||||
to_upload = [x for x in backup_folder.iterdir() if x.name not in objects]
|
||||
logger.warning(
|
||||
"The following files do not already exist and will be backed up: %s", to_upload
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue