When both "encryption_passcommand" and "encryption_passphrase" are configured, prefer "encryption_passphrase" even if it's an empty value (#987).

This commit is contained in:
Dan Helfman
2025-02-03 23:20:31 -08:00
parent 6cfa10fb7e
commit 23009e22aa
3 changed files with 19 additions and 1 deletions
+2
View File
@@ -1,5 +1,7 @@
1.9.10.dev0
* #987: Fix a "list" action error when the "encryption_passcommand" option is set.
* #987: When both "encryption_passcommand" and "encryption_passphrase" are configured, prefer
"encryption_passphrase" even if it's an empty value.
1.9.9
* #635: Log the repository path or label on every relevant log message, not just some logs.
+1 -1
View File
@@ -47,4 +47,4 @@ def get_passphrase_from_passcommand(config):
passphrase = config.get('encryption_passphrase')
working_directory = borgmatic.config.paths.get_working_directory(config)
return run_passcommand(passcommand, bool(passphrase), working_directory)
return run_passcommand(passcommand, bool(passphrase is not None), working_directory)
+16
View File
@@ -53,3 +53,19 @@ def test_get_passphrase_from_passcommand_with_configured_passphrase_and_passcomm
)
is None
)
def test_get_passphrase_from_passcommand_with_configured_blank_passphrase_and_passcommand_detects_passphrase():
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(
'/working'
)
flexmock(module).should_receive('run_passcommand').with_args(
'command', True, '/working'
).and_return(None).once()
assert (
module.get_passphrase_from_passcommand(
{'encryption_passphrase': '', 'encryption_passcommand': 'command'},
)
is None
)