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

This commit is contained in:
Dan Helfman 2023-07-22 10:26:52 -07:00
parent 309f67e860
commit 4d7a2876a5
4 changed files with 18 additions and 2 deletions

3
NEWS
View File

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

View File

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

View File

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

View File

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