Exclude / include info
This commit is contained in:
parent
5287f7be8e
commit
3e0861c85e
|
@ -12,10 +12,13 @@ class Container:
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.id = data.get('Id')
|
self.id = data.get('Id')
|
||||||
self.state = data.get('State')
|
self.state = data.get('State')
|
||||||
self.labels = data.get('Labels')
|
self.labels = data.get('Labels', {})
|
||||||
self.names = data.get('Names')
|
self.names = data.get('Names', [])
|
||||||
self.mounts = [Mount(mnt, container=self) for mnt in data.get('Mounts')]
|
self.mounts = [Mount(mnt, container=self) for mnt in data.get('Mounts')]
|
||||||
|
|
||||||
|
self.include = self.labels.get('restic-volume-backup.enabled', '').split(',')
|
||||||
|
self.exlude = self.labels.get('restic-volume-backup.exclude', '').split(',')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def backup_enabled(self):
|
def backup_enabled(self):
|
||||||
return self.labels.get('restic-volume-backup.enabled') == 'True'
|
return self.labels.get('restic-volume-backup.enabled') == 'True'
|
||||||
|
@ -133,11 +136,19 @@ class RunningContainers:
|
||||||
|
|
||||||
for container in self.all_containers:
|
for container in self.all_containers:
|
||||||
# Weed out containers not beloging to this project.
|
# Weed out containers not beloging to this project.
|
||||||
if container.project_name == self.backup_container.project_name:
|
if container.project_name != self.backup_container.project_name:
|
||||||
# Keep only containers with backup enabled
|
continue
|
||||||
# and not oneoffs (started manually with run or similar)
|
|
||||||
if container.backup_enabled and not container.is_oneoff:
|
# Keep only containers with backup enabled
|
||||||
self.containers.append(container)
|
if not container.backup_enabled:
|
||||||
|
container
|
||||||
|
|
||||||
|
# and not oneoffs (started manually with run or similar)
|
||||||
|
if container.is_oneoff:
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.containers.append(container)
|
||||||
|
|
||||||
|
|
||||||
def backup_volumes(self):
|
def backup_volumes(self):
|
||||||
return self.backup_container.mounts
|
return self.backup_container.mounts
|
||||||
|
|
Loading…
Reference in New Issue