Explorar el Código

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

Dan Helfman hace 5 años
padre
commit
896401088e
Se han modificado 3 ficheros con 8 adiciones y 1 borrados
  1. 1 0
      NEWS
  2. 1 1
      borgmatic/borg/check.py
  3. 6 0
      tests/unit/borg/test_check.py

+ 1 - 0
NEWS

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

+ 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
     "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 ()
 

+ 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
 
 
+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']})