is_true function for checking label value truthfullness

This commit is contained in:
Einar Forselv 2019-04-19 17:14:29 +02:00
parent 59cfb40d27
commit 07628998dd
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,8 @@ import docker
from restic_volume_backup.config import Config from restic_volume_backup.config import Config
TRUE_VALUES = ['1', 'true', 'True', True, 1]
def list_containers(): def list_containers():
""" """
@ -15,3 +17,10 @@ def list_containers():
all_containers = client.containers.list() all_containers = client.containers.list()
client.close() client.close()
return [c.attrs for c in all_containers] 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