Browse Source

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

master
Dan Helfman 1 year ago
parent
commit
a155eefa23
  1. 2
      NEWS
  2. 2
      borgmatic/borg/environment.py
  3. 12
      tests/unit/borg/test_environment.py

2
NEWS

@ -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.

2
borgmatic/borg/environment.py

@ -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,

12
tests/unit/borg/test_environment.py

@ -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

Loading…
Cancel
Save