From 2bb27aadc4db1a163327b5ad555853bb1e27b174 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 19 Oct 2023 23:15:24 +0200 Subject: [PATCH] fix: handle not running container --- backupbot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backupbot.py b/backupbot.py index ab1745f..7efae8f 100755 --- a/backupbot.py +++ b/backupbot.py @@ -90,16 +90,16 @@ def get_backup_cmds(): if SERVICE and SERVICE != stack_name: continue backup_apps.add(stack_name) - container = container_by_service.get(s.name) - if not container: + backup_paths = backup_paths.union( + Path(VOLUME_PATH).glob(f"{stack_name}_*")) + if not (container:= container_by_service.get(s.name)): logging.error( f"Container {s.name} is not running, hooks can not be executed") + continue if prehook := labels.get('backupbot.backup.pre-hook'): pre_commands[container] = prehook if posthook := labels.get('backupbot.backup.post-hook'): post_commands[container] = posthook - backup_paths = backup_paths.union( - Path(VOLUME_PATH).glob(f"{stack_name}_*")) return pre_commands, post_commands, list(backup_paths), list(backup_apps)