فهرست منبع

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

Dan Helfman 7 سال پیش
والد
کامیت
50b3240c4f
3فایلهای تغییر یافته به همراه12 افزوده شده و 2 حذف شده
  1. 2 0
      NEWS
  2. 4 2
      borgmatic/borg/check.py
  3. 6 0
      borgmatic/tests/unit/borg/test_check.py

+ 2 - 0
NEWS

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

+ 4 - 2
borgmatic/borg/check.py

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

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

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