2
0
Эх сурвалжийг харах

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

Dan Helfman 5 жил өмнө
parent
commit
896401088e

+ 1 - 0
NEWS

@@ -1,4 +1,5 @@
 1.3.15.dev0
 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
  * #209: Bypass Borg error about a moved repository via "relocated_repo_access_is_ok" option in
    borgmatic storage configuration section.
    borgmatic storage configuration section.
 
 

+ 1 - 1
borgmatic/borg/check.py

@@ -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
     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.
     "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']:
     if checks == ['disabled']:
         return ()
         return ()
 
 

+ 6 - 0
tests/unit/borg/test_check.py

@@ -34,6 +34,12 @@ def test_parse_checks_with_blank_value_returns_defaults():
     assert checks == module.DEFAULT_CHECKS
     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():
 def test_parse_checks_with_disabled_returns_no_checks():
     checks = module._parse_checks({'checks': ['disabled']})
     checks = module._parse_checks({'checks': ['disabled']})