Przeglądaj źródła

Fix bootstrap --progress flag (#303).

Dan Helfman 2 miesięcy temu
rodzic
commit
10fb02c40a

+ 3 - 1
borgmatic/actions/config/bootstrap.py

@@ -119,7 +119,9 @@ def run_bootstrap(bootstrap_arguments, global_arguments, local_borg_version):
         bootstrap_arguments.repository,
         archive_name,
         [config_path.lstrip(os.path.sep) for config_path in manifest_config_paths],
-        config,
+        # Only add progress here and not the extract_archive() call above, because progress
+        # conflicts with extract_to_stdout.
+        dict(config, progress=bootstrap_arguments.progress or False),
         local_borg_version,
         global_arguments,
         local_path=bootstrap_arguments.local_path,

+ 5 - 3
tests/unit/actions/config/test_bootstrap.py

@@ -105,7 +105,7 @@ def test_get_config_paths_translates_ssh_command_argument_to_config():
     flexmock(module.borgmatic.config.paths).should_receive(
         'get_borgmatic_source_directory'
     ).and_return('/source')
-    config = flexmock()
+    config = {}
     flexmock(module).should_receive('make_bootstrap_config').and_return(config)
     bootstrap_arguments = flexmock(
         repository='repo',
@@ -271,6 +271,7 @@ def test_run_bootstrap_does_not_raise():
         ssh_command=None,
         local_path='borg7',
         remote_path='borg8',
+        progress=None,
     )
     global_arguments = flexmock(
         dry_run=False,
@@ -298,7 +299,7 @@ def test_run_bootstrap_does_not_raise():
 
 
 def test_run_bootstrap_translates_ssh_command_argument_to_config():
-    config = flexmock()
+    config = {}
     flexmock(module).should_receive('make_bootstrap_config').and_return(config)
     flexmock(module).should_receive('get_config_paths').and_return(['/borgmatic/config.yaml'])
     bootstrap_arguments = flexmock(
@@ -310,6 +311,7 @@ def test_run_bootstrap_translates_ssh_command_argument_to_config():
         ssh_command='ssh -i key',
         local_path='borg7',
         remote_path='borg8',
+        progress=None,
     )
     global_arguments = flexmock(
         dry_run=False,
@@ -331,7 +333,7 @@ def test_run_bootstrap_translates_ssh_command_argument_to_config():
         'repo',
         'archive',
         object,
-        config,
+        {'progress': False},
         object,
         object,
         extract_to_stdout=False,