Skip to content

Commit 34f216a

Browse files
author
Ivan Golman
committed
chore: apply container stop action in compose to current project only
1 parent 50e6c6a commit 34f216a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/restic_compose_backup/containers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def mariadb_backup_enabled(self) -> bool:
171171
def postgresql_backup_enabled(self) -> bool:
172172
"""bool: If the ``stack-back.postgres`` label is set"""
173173
return utils.is_true(self.get_label(enums.LABEL_POSTGRES_ENABLED))
174-
174+
175175
@property
176176
def stop_during_backup(self) -> bool:
177177
"""bool: If the ``stack-back.volumes.stop-during-backup`` label is set"""
@@ -387,13 +387,17 @@ def __init__(self):
387387

388388
# Gather stop during backup containers
389389
if container.stop_during_backup:
390-
self.stop_during_backup_containers.append(container)
390+
if config.swarm_mode:
391+
self.stop_during_backup_containers.append(container)
392+
else:
393+
if container.project_name == self.this_container.project_name:
394+
self.stop_during_backup_containers.append(container)
391395

392396
# Detect running backup process container
393397
if container.is_backup_process_container:
394398
self.backup_process_container = container
395399

396-
# --- Determine what containers should be evaludated
400+
# --- Determine what containers should be evaluated
397401

398402
# If not swarm mode we need to filter in compose project
399403
if not config.swarm_mode:

stack-back.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# DOCKER_TLS_VERIFY=1
55
# DOCKER_CERT_PATH=''
66

7-
SWARM_MODE=false
7+
# SWARM_MODE=
88
INCLUDE_PROJECT_NAME=false
99
EXCLUDE_BIND_MOUNTS=false
1010

0 commit comments

Comments
 (0)