浏览代码

Fix for "prune" action error when using the "keep_exclude_tags" option in configuration (#728).

Dan Helfman 2 年之前
父节点
当前提交
4d7a2876a5
共有 4 个文件被更改,包括 18 次插入2 次删除
  1. 3 0
      NEWS
  2. 1 1
      borgmatic/borg/prune.py
  3. 1 1
      setup.py
  4. 13 0
      tests/unit/borg/test_prune.py

+ 3 - 0
NEWS

@@ -1,3 +1,6 @@
+1.8.1.dev0
+ * #728: Fix for "prune" action error when using the "keep_exclude_tags" option in configuration.
+
 1.8.0
  * #575: BREAKING: For the "borgmatic borg" action, instead of implicitly injecting
    repository/archive into the resulting Borg command-line, pass repository to Borg via an

+ 1 - 1
borgmatic/borg/prune.py

@@ -26,7 +26,7 @@ def make_prune_flags(config, local_borg_version):
     flag_pairs = (
         ('--' + option_name.replace('_', '-'), str(value))
         for option_name, value in config.items()
-        if option_name.startswith('keep_')
+        if option_name.startswith('keep_') and option_name != 'keep_exclude_tags'
     )
     prefix = config.get('prefix')
 

+ 1 - 1
setup.py

@@ -1,6 +1,6 @@
 from setuptools import find_packages, setup
 
-VERSION = '1.8.0'
+VERSION = '1.8.1.dev0'
 
 
 setup(

+ 13 - 0
tests/unit/borg/test_prune.py

@@ -118,6 +118,19 @@ def test_make_prune_flags_without_prefix_uses_archive_name_format_instead():
     assert result == expected
 
 
+def test_make_prune_flags_ignores_keep_exclude_tags_in_config():
+    config = {
+        'keep_daily': 1,
+        'keep_exclude_tags': True,
+    }
+    flexmock(module.feature).should_receive('available').and_return(True)
+    flexmock(module.flags).should_receive('make_match_archives_flags').and_return(())
+
+    result = module.make_prune_flags(config, local_borg_version='1.2.3')
+
+    assert result == ('--keep-daily', '1')
+
+
 PRUNE_COMMAND = ('borg', 'prune', '--keep-daily', '1', '--keep-weekly', '2', '--keep-monthly', '3')