Ensure backup process actions don't happen in the main container

This commit is contained in:
Einar Forselv 2019-04-18 05:44:59 +02:00
parent 862cb47da9
commit 82cabb16b3
1 changed files with 9 additions and 2 deletions

View File

@ -27,8 +27,8 @@ def status(config, containers):
"""Outputs the backup config for the compse setup""" """Outputs the backup config for the compse setup"""
print() print()
print("Backup config for compose project '{}'".format(containers.this_container.project_name)) print("Backup config for compose project '{}'".format(containers.this_container.project_name))
print("Backup service:", containers.this_container.name) print("Current service:", containers.this_container.name)
print("Backup process:", containers.backup_process_container.name \ print("Backup process :", containers.backup_process_container.name \
if containers.backup_process_container else 'Not Running') if containers.backup_process_container else 'Not Running')
print() print()
@ -67,6 +67,13 @@ def backup(config, containers):
def start_backup_process(config, containers): def start_backup_process(config, containers):
"""Start the backup process container""" """Start the backup process container"""
if not containers.backup_process_container or containers.this_container == containers.backup_process_container is False:
print(
"Cannot run backup process in this container. Use backup command instead. "
"This will spawn a new container with the necessary mounts."
)
return
print("start-backup-process") print("start-backup-process")
status(config, containers) status(config, containers)