add --no_commands flag for restore
This commit is contained in:
parent
43548273fe
commit
9dc239b199
11
backupbot.py
11
backupbot.py
@ -112,7 +112,8 @@ def create(retries):
|
|||||||
@click.option('noninteractive', '--noninteractive', envvar='NONINTERACTIVE', is_flag=True)
|
@click.option('noninteractive', '--noninteractive', envvar='NONINTERACTIVE', is_flag=True)
|
||||||
@click.option('volumes', '--volumes', '-v', envvar='VOLUMES', multiple=True)
|
@click.option('volumes', '--volumes', '-v', envvar='VOLUMES', multiple=True)
|
||||||
@click.option('container', '--container', '-c', envvar='CONTAINER', multiple=True)
|
@click.option('container', '--container', '-c', envvar='CONTAINER', multiple=True)
|
||||||
def restore(snapshot, target, noninteractive, volumes, container):
|
@click.option('no_commands', '--no-commands', envvar='NO_COMMANDS', is_flag=True)
|
||||||
|
def restore(snapshot, target, noninteractive, volumes, container, no_commands):
|
||||||
app_settings = parse_backup_labels('restore', container)
|
app_settings = parse_backup_labels('restore', container)
|
||||||
if SERVICE != 'ALL':
|
if SERVICE != 'ALL':
|
||||||
app_settings = {SERVICE: app_settings[SERVICE]}
|
app_settings = {SERVICE: app_settings[SERVICE]}
|
||||||
@ -136,9 +137,13 @@ def restore(snapshot, target, noninteractive, volumes, container):
|
|||||||
logger.error("Restore aborted")
|
logger.error("Restore aborted")
|
||||||
exit(1)
|
exit(1)
|
||||||
print(f"Restoring Snapshot {snapshot} at {target}")
|
print(f"Restoring Snapshot {snapshot} at {target}")
|
||||||
run_commands(pre_commands)
|
if not no_commands and pre_commands:
|
||||||
|
print(f"Run pre commands.")
|
||||||
|
run_commands(pre_commands)
|
||||||
result = restic_restore(snapshot_id=snapshot, include=backup_paths, target_dir=target)
|
result = restic_restore(snapshot_id=snapshot, include=backup_paths, target_dir=target)
|
||||||
run_commands(post_commands)
|
if not no_commands and post_commands:
|
||||||
|
print(f"Run post commands.")
|
||||||
|
run_commands(post_commands)
|
||||||
logger.debug(result)
|
logger.debug(result)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user