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)