From 33b81a52f018634d5631cc4d1717a8f1da8438e4 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Wed, 17 Apr 2019 03:17:50 +0200 Subject: [PATCH] Detect running backup process container --- restic_volume_backup/containers.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/restic_volume_backup/containers.py b/restic_volume_backup/containers.py index 8710d55..7fa3550 100644 --- a/restic_volume_backup/containers.py +++ b/restic_volume_backup/containers.py @@ -174,14 +174,15 @@ class RunningContainers: if not self.this_container: raise ValueError("Cannot find metadata for backup container") - # Detect running backup process container - - - # Gather all containers in the current compose setup for container_data in all_containers: - # pprint.pprint(container_data, indent=2) container = Container(container_data) + + # Detect running backup process container + if container.is_backup_process_container: + self.backup_process_container = container + + # Detect containers beloging to the current compose setup if container.project_name == self.this_container.project_name: if container.id != self.this_container.id: self.containers.append(container) @@ -216,6 +217,7 @@ class RunningContainers: # """Host mapped volumes""" # return set(mnt for mnt in self.gen_volumes(VOLUME_TYPE_BIND)) + @property def backup_process_running(self) -> bool: """Is the backup process container running?""" return self.backup_process_container is not None