mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-09-28 06:35:24 +00:00
Bug: Ensure container properties are fetched safely
This commit is contained in:
@@ -54,17 +54,17 @@ class Container:
|
|||||||
@property
|
@property
|
||||||
def service_name(self):
|
def service_name(self):
|
||||||
"""Name of the container/service"""
|
"""Name of the container/service"""
|
||||||
return self.labels['com.docker.compose.service']
|
return self.labels.get('com.docker.compose.service', '')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def project_name(self):
|
def project_name(self):
|
||||||
"""Name of the compose setup"""
|
"""Name of the compose setup"""
|
||||||
return self.labels['com.docker.compose.project']
|
return self.labels.get('com.docker.compose.project', {})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_oneoff(self):
|
def is_oneoff(self):
|
||||||
"""Was this container started with run command?"""
|
"""Was this container started with run command?"""
|
||||||
return self.labels['com.docker.compose.oneoff'] == 'True'
|
return self.labels.get('com.docker.compose.oneoff', 'False') == 'True'
|
||||||
|
|
||||||
def filter_mounts(self):
|
def filter_mounts(self):
|
||||||
"""Get all mounts for this container matching include/exclude filters"""
|
"""Get all mounts for this container matching include/exclude filters"""
|
||||||
|
Reference in New Issue
Block a user