Fix for traceback when the "checks" option has an empty value (#208).

This commit is contained in:
Dan Helfman 2019-08-26 09:52:32 -07:00
parent ef3dda9213
commit 896401088e
3 changed files with 8 additions and 1 deletions

1
NEWS
View file

@ -1,4 +1,5 @@
1.3.15.dev0
* #208: Fix for traceback when the "checks" option has an empty value.
* #209: Bypass Borg error about a moved repository via "relocated_repo_access_is_ok" option in
borgmatic storage configuration section.

View file

@ -25,7 +25,7 @@ def _parse_checks(consistency_config):
If no "checks" option is present, return the DEFAULT_CHECKS. If the checks value is the string
"disabled", return an empty tuple, meaning that no checks should be run.
'''
checks = consistency_config.get('checks', [])
checks = consistency_config.get('checks', []) or []
if checks == ['disabled']:
return ()

View file

@ -34,6 +34,12 @@ def test_parse_checks_with_blank_value_returns_defaults():
assert checks == module.DEFAULT_CHECKS
def test_parse_checks_with_none_value_returns_defaults():
checks = module._parse_checks({'checks': None})
assert checks == module.DEFAULT_CHECKS
def test_parse_checks_with_disabled_returns_no_checks():
checks = module._parse_checks({'checks': ['disabled']})