Merge branch 'main' into keepassxc-docker-podman-file-credentials

This commit is contained in:
Dan Helfman 2025-02-12 09:14:49 -08:00
commit 5661b67cde
3 changed files with 21 additions and 7 deletions

3
NEWS
View File

@ -1,6 +1,9 @@
1.9.11.dev0
* #996: Fix the "create" action to omit the repository label prefix from Borg's output when
databases are enabled.
* Add credential loading from file, KeePassXC, and Docker/Podman secrets. See the documentation for
more information: https://torsion.org/borgmatic/docs/how-to/provide-your-passwords/
1.9.10
* #966: Add a "{credential ...}" syntax for loading systemd credentials into borgmatic
configuration files. See the documentation for more information:

View File

@ -430,13 +430,14 @@ def execute_command_with_processes(
process.kill()
raise
captured_outputs = log_outputs(
tuple(processes) + (command_process,),
(input_file, output_file),
output_log_level,
borg_local_path,
borg_exit_codes,
)
with borgmatic.logger.Log_prefix(None): # Log command output without any prefix.
captured_outputs = log_outputs(
tuple(processes) + (command_process,),
(input_file, output_file),
output_log_level,
borg_local_path,
borg_exit_codes,
)
if output_log_level is None:
return captured_outputs.get(command_process)

View File

@ -554,6 +554,7 @@ def test_execute_command_with_processes_calls_full_command():
cwd=None,
close_fds=True,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(full_command, processes)
@ -577,6 +578,7 @@ def test_execute_command_with_processes_returns_output_with_output_log_level_non
cwd=None,
close_fds=True,
).and_return(process).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs').and_return({process: 'out'})
output = module.execute_command_with_processes(full_command, processes, output_log_level=None)
@ -600,6 +602,7 @@ def test_execute_command_with_processes_calls_full_command_with_output_file():
cwd=None,
close_fds=True,
).and_return(flexmock(stderr=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(full_command, processes, output_file=output_file)
@ -623,6 +626,7 @@ def test_execute_command_with_processes_calls_full_command_without_capturing_out
close_fds=True,
).and_return(flexmock(wait=lambda: 0)).once()
flexmock(module).should_receive('interpret_exit_code').and_return(module.Exit_status.SUCCESS)
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(
@ -648,6 +652,7 @@ def test_execute_command_with_processes_calls_full_command_with_input_file():
cwd=None,
close_fds=True,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(full_command, processes, input_file=input_file)
@ -670,6 +675,7 @@ def test_execute_command_with_processes_calls_full_command_with_shell():
cwd=None,
close_fds=True,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(full_command, processes, shell=True)
@ -692,6 +698,7 @@ def test_execute_command_with_processes_calls_full_command_with_extra_environmen
cwd=None,
close_fds=True,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(
@ -716,6 +723,7 @@ def test_execute_command_with_processes_calls_full_command_with_working_director
cwd='/working',
close_fds=True,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(
@ -740,6 +748,7 @@ def test_execute_command_with_processes_with_BORG_PASSPHRASE_FD_leaves_file_desc
cwd=None,
close_fds=False,
).and_return(flexmock(stdout=None)).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs')
output = module.execute_command_with_processes(
@ -769,6 +778,7 @@ def test_execute_command_with_processes_kills_processes_on_error():
cwd=None,
close_fds=True,
).and_raise(subprocess.CalledProcessError(1, full_command, 'error')).once()
flexmock(module.borgmatic.logger).should_receive('Log_prefix').and_return(flexmock())
flexmock(module).should_receive('log_outputs').never()
with pytest.raises(subprocess.CalledProcessError):