From 7fe1886ff94c89a3644c7811e398a5a11515a9ad Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 11 Jan 2024 12:20:38 +0100 Subject: [PATCH] Solved trailing spaces bug --- backup-docker-to-local.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backup-docker-to-local.py b/backup-docker-to-local.py index 3d4864c..f35487e 100644 --- a/backup-docker-to-local.py +++ b/backup-docker-to-local.py @@ -142,12 +142,17 @@ def get_last_backup_dir(volume_name, current_backup_dir): return None def getStoragePath(volume_name): - return execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}")[0] + path = execute_shell_command(f"docker volume inspect --format '{{{{ .Mountpoint }}}}' {volume_name}")[0] + return f"{path}/" + +def getFileRsyncDestinationPath(volume_dir): + path = os.path.join(volume_dir, "files") + return f"{path}/" def backup_volume(volume_name, volume_dir): """Backup files of a volume with incremental backups.""" print(f"Starting backup routine for volume: {volume_name}") - files_rsync_destination_path = os.path.join(volume_dir, "files") + files_rsync_destination_path = getFileRsyncDestinationPath(volume_dir) pathlib.Path(files_rsync_destination_path).mkdir(parents=True, exist_ok=True) last_backup_dir = get_last_backup_dir(volume_name, files_rsync_destination_path)