restic_restore: extends restic.restore to use multiple --include paths

This commit is contained in:
Moritz 2024-09-17 17:48:20 +02:00
parent eb7c35d4cd
commit cc59087b8c

View File

@ -138,6 +138,15 @@ def restore(snapshot, target, noninteractive):
logger.debug(result)
def restic_restore(snapshot_id='latest', include=[], target_dir=None):
cmd = restic.cat.base_command() + ['restore', snapshot_id]
for path in include:
cmd.extend(['--include', path])
if target_dir:
cmd.extend(['--target', target_dir])
return restic.internal.command_executor.execute(cmd)
def get_snapshots(snapshot_id=None, app=None):
if snapshot_id and snapshot_id != 'latest':
snapshots = restic.snapshots(snapshot_id=snapshot_id)