From fe92d9e8387516b1c676c1429388ad1a81a3cef9 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 18 Feb 2019 21:59:09 -0800 Subject: [PATCH] Fix restore paths list to tuple conversion. --- borgmatic/borg/extract.py | 2 +- tests/unit/borg/test_extract.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/borgmatic/borg/extract.py b/borgmatic/borg/extract.py index f302f49a..078b3cfa 100644 --- a/borgmatic/borg/extract.py +++ b/borgmatic/borg/extract.py @@ -72,7 +72,7 @@ def extract_archive( full_command = ( (local_path, 'extract', '::'.join((repository, archive))) - + (restore_paths if restore_paths else ()) + + (tuple(restore_paths) if restore_paths else ()) + (('--remote-path', remote_path) if remote_path else ()) + (('--umask', str(umask)) if umask else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) diff --git a/tests/unit/borg/test_extract.py b/tests/unit/borg/test_extract.py index 1cf23d2e..a36afb89 100644 --- a/tests/unit/borg/test_extract.py +++ b/tests/unit/borg/test_extract.py @@ -103,6 +103,18 @@ def test_extract_last_archive_dry_run_calls_borg_with_lock_wait_parameters(): module.extract_last_archive_dry_run(repository='repo', lock_wait=5) +def test_extract_archive_calls_borg_with_restore_path_parameters(): + insert_subprocess_mock(('borg', 'extract', 'repo::archive', 'path1', 'path2')) + + module.extract_archive( + dry_run=False, + repository='repo', + archive='archive', + restore_paths=['path1', 'path2'], + storage_config={}, + ) + + def test_extract_archive_calls_borg_with_remote_path_parameters(): insert_subprocess_mock(('borg', 'extract', 'repo::archive', '--remote-path', 'borg1'))