54: Fix for incorrect consistency check flags passed to Borg when all three checks in borgmatic config.

This commit is contained in:
Dan Helfman 2018-01-14 14:09:20 -08:00
parent 18fbc75e16
commit 50b3240c4f
3 changed files with 12 additions and 2 deletions

2
NEWS
View file

@ -1,4 +1,6 @@
1.1.13.dev0
* #54: Fix for incorrect consistency check flags passed to Borg when all three checks ("repository",
"archives", and "extract") are specified in borgmatic configuration.
* Moved issue tracker from Taiga to integrated Gitea tracker at
https://projects.torsion.org/witten/borgmatic/issues

View file

@ -46,10 +46,12 @@ def _make_check_flags(checks, check_last=None):
('--repository-only',)
Additionally, if a check_last value is given, a "--last" flag will be added.
However, if both "repository" and "archives" are in checks, then omit them from the returned
flags because Borg does both checks by default. Additionally, if a check_last value is given,
a "--last" flag will be added.
'''
last_flag = ('--last', str(check_last)) if check_last else ()
if checks == DEFAULT_CHECKS:
if set(DEFAULT_CHECKS).issubset(set(checks)):
return last_flag
return tuple(

View file

@ -60,6 +60,12 @@ def test_make_check_flags_with_default_checks_returns_no_flags():
assert flags == ()
def test_make_check_flags_with_all_checks_returns_no_flags():
flags = module._make_check_flags(module.DEFAULT_CHECKS + ('extract',))
assert flags == ()
def test_make_check_flags_with_checks_and_last_returns_flags_including_last():
flags = module._make_check_flags(('repository',), check_last=3)