Fix for certain configuration options like ssh_command impacting Borg invocations for separate configuration files (#323).

This commit is contained in:
Dan Helfman 2020-06-06 14:30:04 -07:00
parent 398665be9e
commit a155eefa23
3 changed files with 16 additions and 0 deletions

2
NEWS
View file

@ -5,6 +5,8 @@
still trigger a monitoring "fail" status.
* #316: Fix hang when a stale database dump named pipe from an aborted borgmatic run remains on
disk.
* #323: Fix for certain configuration options like ssh_command impacting Borg invocations for
separate configuration files.
* Tweak comment indentation in generated configuration file for clarity.
* Link to Borgmacator GNOME AppIndicator from monitoring documentation.

View file

@ -22,6 +22,8 @@ def initialize(storage_config):
value = storage_config.get(option_name)
if value:
os.environ[environment_variable_name] = value
else:
os.environ.pop(environment_variable_name, None)
for (
option_name,

View file

@ -60,3 +60,15 @@ def test_initialize_with_relocated_repo_access_should_override_default():
assert os.environ.get('BORG_RELOCATED_REPO_ACCESS_IS_OK') == 'yes'
finally:
os.environ = orig_environ
def test_initialize_is_not_effected_by_existing_environment():
orig_environ = os.environ
try:
os.environ = {'BORG_PASSPHRASE': 'pass', 'BORG_SSH': 'mosh'}
module.initialize({'ssh_command': 'ssh -C'})
assert 'BORG_PASSPHRASE' not in os.environ
assert os.environ.get('BORG_RSH') == 'ssh -C'
finally:
os.environ = orig_environ