choos specific restore target

This commit is contained in:
2023-09-07 13:10:10 +02:00
parent 56eafa714e
commit 89487cc219
3 changed files with 13 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import os
import click
import json
import subprocess
# todo json logging
import logging
import docker
import restic
@ -106,9 +105,15 @@ def backup_volumes(backup_paths, apps, dry_run=False):
@cli.command()
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
def restore(snapshot):
service_paths = f'/var/lib/docker/volumes/{SERVICE}_*'
result = restic.restore(snapshot_id=snapshot, include=service_paths, target_dir='/')
@click.option('target', '--target', '-t', envvar='TARGET', default='/')
def restore(snapshot, target):
# Todo: recommend to shutdown the container
service_paths = VOLUME_PATH
if SERVICE:
service_paths = service_paths + f'{SERVICE}_*'
print(f"restoring Snapshot {snapshot} of {service_paths} at {target}")
result = restic.restore(snapshot_id=snapshot, include=service_paths, target_dir=target)
logging.debug(result)
@cli.command()