Run repo init in status command

This commit is contained in:
Einar Forselv 2019-12-05 12:54:34 +01:00
parent 7f588c57ab
commit a0dfb04aa7
1 changed files with 3 additions and 5 deletions

View File

@ -49,6 +49,9 @@ def status(config, containers):
logger.info("Backup currently running?: %s", containers.backup_process_running) logger.info("Backup currently running?: %s", containers.backup_process_running)
logger.info("%s Detected Config %s", "-" * 25, "-" * 25) logger.info("%s Detected Config %s", "-" * 25, "-" * 25)
logger.info("Initializing repository (may fail if already initalized)")
restic.init_repo(config.repository)
backup_containers = containers.containers_for_backup() backup_containers = containers.containers_for_backup()
for container in backup_containers: for container in backup_containers:
logger.info('service: %s', container.service_name) logger.info('service: %s', container.service_name)
@ -77,11 +80,6 @@ def backup(config, containers):
if containers.backup_process_running: if containers.backup_process_running:
raise ValueError("Backup process already running") raise ValueError("Backup process already running")
logger.info("Initializing repository (may fail if already initalized)")
# TODO: Errors when repo already exists
restic.init_repo(config.repository)
# Map all volumes from the backup container into the backup process container # Map all volumes from the backup container into the backup process container
volumes = containers.this_container.volumes volumes = containers.this_container.volumes