fix: handle not running container
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Moritz 2023-10-19 23:15:24 +02:00
parent 66e1c9617d
commit 2bb27aadc4
1 changed files with 4 additions and 4 deletions

View File

@ -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)