Backup process label is now unique for each project
This commit is contained in:
parent
be74715595
commit
e8123922df
|
@ -113,7 +113,7 @@ def backup(config, containers):
|
|||
environment=containers.this_container.environment,
|
||||
source_container_id=containers.this_container.id,
|
||||
labels={
|
||||
"restic-compose-backup.backup_process": 'True',
|
||||
containers.backup_process_label: 'True',
|
||||
"com.docker.compose.project": containers.project_name,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -141,7 +141,7 @@ class Container:
|
|||
@property
|
||||
def is_backup_process_container(self) -> bool:
|
||||
"""Is this container the running backup process?"""
|
||||
return self.get_label(enums.LABEL_BACKUP_PROCESS) == 'True'
|
||||
return self.get_label(self.backup_process_label) == 'True'
|
||||
|
||||
@property
|
||||
def is_running(self) -> bool:
|
||||
|
@ -158,6 +158,11 @@ class Container:
|
|||
"""Name of the container/service"""
|
||||
return self.get_label('com.docker.compose.service', default='')
|
||||
|
||||
@property
|
||||
def backup_process_label(self) -> str:
|
||||
"""str: The unique backup process label for this project"""
|
||||
return f"{enums.LABEL_BACKUP_PROCESS}-{self.project_name}"
|
||||
|
||||
@property
|
||||
def project_name(self) -> str:
|
||||
"""Name of the compose setup"""
|
||||
|
@ -358,6 +363,11 @@ class RunningContainers:
|
|||
"""str: Name of the compose project"""
|
||||
return self.this_container.project_name
|
||||
|
||||
@property
|
||||
def backup_process_label(self) -> str:
|
||||
"""str: The backup process label for this project"""
|
||||
return self.this_container.backup_process_label
|
||||
|
||||
@property
|
||||
def backup_process_running(self) -> bool:
|
||||
"""Is the backup process container running?"""
|
||||
|
|
|
@ -8,4 +8,4 @@ LABEL_MYSQL_ENABLED = 'restic-compose-backup.mysql'
|
|||
LABEL_POSTGRES_ENABLED = 'restic-compose-backup.postgres'
|
||||
LABEL_MARIADB_ENABLED = 'restic-compose-backup.mariadb'
|
||||
|
||||
LABEL_BACKUP_PROCESS = 'restic-compose-backup.backup_process'
|
||||
LABEL_BACKUP_PROCESS = 'restic-compose-backup.process'
|
||||
|
|
Loading…
Reference in New Issue