From 62b6f1329923020da8ffdbe0dc6109f5358189bb Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Thu, 15 Jun 2023 23:02:09 +0530 Subject: [PATCH] add restore-path support for sqlite --- borgmatic/actions/restore.py | 1 + borgmatic/hooks/sqlite.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/borgmatic/actions/restore.py b/borgmatic/actions/restore.py index 532c587..156f376 100644 --- a/borgmatic/actions/restore.py +++ b/borgmatic/actions/restore.py @@ -316,6 +316,7 @@ def run_restore( 'port': restore_arguments.port, 'username': restore_arguments.username, 'password': restore_arguments.password, + 'restore_path': restore_arguments.restore_path, } if not found_database: diff --git a/borgmatic/hooks/sqlite.py b/borgmatic/hooks/sqlite.py index d9f105d..4e4e0be 100644 --- a/borgmatic/hooks/sqlite.py +++ b/borgmatic/hooks/sqlite.py @@ -85,7 +85,7 @@ def make_database_dump_pattern( return dump.make_database_dump_filename(make_dump_path(location_config), name) -def restore_database_dump(database_config, log_prefix, location_config, dry_run, extract_process): +def restore_database_dump(database_config, log_prefix, location_config, dry_run, extract_process, connection_params): ''' Restore the given SQLite3 database from an extract stream. The database is supplied as a one-element sequence containing a dict describing the database, as per the configuration schema. @@ -98,7 +98,7 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run, if len(database_config) != 1: raise ValueError('The database configuration value is invalid') - database_path = database_config[0]['path'] + database_path = connection_params['restore_path'] or database_config[0].get('restore_path', database_config[0].get('path')) logger.debug(f'{log_prefix}: Restoring SQLite database at {database_path}{dry_run_label}') if dry_run: