From 07628998ddb708700cf10abd6e0736dfa2b0cde3 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Fri, 19 Apr 2019 17:14:29 +0200 Subject: [PATCH] is_true function for checking label value truthfullness --- restic_volume_backup/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/restic_volume_backup/utils.py b/restic_volume_backup/utils.py index 734636e..8d8d6db 100644 --- a/restic_volume_backup/utils.py +++ b/restic_volume_backup/utils.py @@ -2,6 +2,8 @@ import docker from restic_volume_backup.config import Config +TRUE_VALUES = ['1', 'true', 'True', True, 1] + def list_containers(): """ @@ -15,3 +17,10 @@ def list_containers(): all_containers = client.containers.list() client.close() return [c.attrs for c in all_containers] + + +def is_true(self, value): + """ + Evaluates the truthfullness of a bool value in container labels + """ + return value in TRUE_VALUES