From fb14d65878814d5a5960d8be97b09cf8cf04da2b Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Tue, 16 Apr 2019 20:55:22 +0200 Subject: [PATCH] Support getting a service by name --- restic_volume_backup/containers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/restic_volume_backup/containers.py b/restic_volume_backup/containers.py index 7b140fe..5687295 100644 --- a/restic_volume_backup/containers.py +++ b/restic_volume_backup/containers.py @@ -173,6 +173,13 @@ class RunningContainers: # """Host mapped volumes""" # return set(mnt for mnt in self.gen_volumes(VOLUME_TYPE_BIND)) + def get_service(self, name): + for container in self.containers: + if container.service_name == name: + return container + + return None + def print_services(self): print() print("Backup config for compose project '{}'".format(self.this_container.project_name))