From 896401088e056107e109f89fc06c4971d3a5aafe Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 26 Aug 2019 09:52:32 -0700 Subject: [PATCH] Fix for traceback when the "checks" option has an empty value (#208). --- NEWS | 1 + borgmatic/borg/check.py | 2 +- tests/unit/borg/test_check.py | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f054e72cb..384e73802 100644 --- a/NEWS +++ b/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. diff --git a/borgmatic/borg/check.py b/borgmatic/borg/check.py index 678dd46d7..bbcd8d727 100644 --- a/borgmatic/borg/check.py +++ b/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 () diff --git a/tests/unit/borg/test_check.py b/tests/unit/borg/test_check.py index 202d64148..24535773a 100644 --- a/tests/unit/borg/test_check.py +++ b/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']})