Support for Borg --keep-exclude-tags and --exclude-nodump options (#234).
This commit is contained in:
parent
76c569cf84
commit
f48f52079d
5 changed files with 50 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -1,3 +1,6 @@
|
||||||
|
1.4.4
|
||||||
|
* #234: Support for Borg --keep-exclude-tags and --exclude-nodump options.
|
||||||
|
|
||||||
1.4.3
|
1.4.3
|
||||||
* Monitor backups with Cronitor hook integration. See the documentation for more information:
|
* Monitor backups with Cronitor hook integration. See the documentation for more information:
|
||||||
https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#cronitor-hook
|
https://torsion.org/borgmatic/docs/how-to/monitor-your-backups/#cronitor-hook
|
||||||
|
|
|
@ -90,8 +90,18 @@ def _make_exclude_flags(location_config, exclude_filename=None):
|
||||||
caches_flag = ('--exclude-caches',) if location_config.get('exclude_caches') else ()
|
caches_flag = ('--exclude-caches',) if location_config.get('exclude_caches') else ()
|
||||||
if_present = location_config.get('exclude_if_present')
|
if_present = location_config.get('exclude_if_present')
|
||||||
if_present_flags = ('--exclude-if-present', if_present) if if_present else ()
|
if_present_flags = ('--exclude-if-present', if_present) if if_present else ()
|
||||||
|
keep_exclude_tags_flags = (
|
||||||
|
('--keep-exclude-tags',) if location_config.get('keep_exclude_tags') else ()
|
||||||
|
)
|
||||||
|
exclude_nodump_flags = ('--exclude-nodump',) if location_config.get('exclude_nodump') else ()
|
||||||
|
|
||||||
return exclude_from_flags + caches_flag + if_present_flags
|
return (
|
||||||
|
exclude_from_flags
|
||||||
|
+ caches_flag
|
||||||
|
+ if_present_flags
|
||||||
|
+ keep_exclude_tags_flags
|
||||||
|
+ exclude_nodump_flags
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
BORGMATIC_SOURCE_DIRECTORY = '~/.borgmatic'
|
BORGMATIC_SOURCE_DIRECTORY = '~/.borgmatic'
|
||||||
|
|
|
@ -126,6 +126,17 @@ map:
|
||||||
Exclude directories that contain a file with the given filename. Defaults to not
|
Exclude directories that contain a file with the given filename. Defaults to not
|
||||||
set.
|
set.
|
||||||
example: .nobackup
|
example: .nobackup
|
||||||
|
keep_exclude_tags:
|
||||||
|
type: bool
|
||||||
|
desc: |
|
||||||
|
If true, the exclude_if_present filename is included in backups. Defaults to
|
||||||
|
false, meaning that the exclude_if_present filename is omitted from backups.
|
||||||
|
example: true
|
||||||
|
exclude_nodump:
|
||||||
|
type: bool
|
||||||
|
desc: |
|
||||||
|
Exclude files with the NODUMP flag. Defaults to false.
|
||||||
|
example: true
|
||||||
storage:
|
storage:
|
||||||
desc: |
|
desc: |
|
||||||
Repository storage options. See
|
Repository storage options. See
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -1,6 +1,6 @@
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
VERSION = '1.4.3'
|
VERSION = '1.4.4'
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|
|
@ -150,6 +150,30 @@ def test_make_exclude_flags_includes_exclude_if_present_when_in_config():
|
||||||
assert exclude_flags == ('--exclude-if-present', 'exclude_me')
|
assert exclude_flags == ('--exclude-if-present', 'exclude_me')
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_exclude_flags_includes_keep_exclude_tags_when_true_in_config():
|
||||||
|
exclude_flags = module._make_exclude_flags(location_config={'keep_exclude_tags': True})
|
||||||
|
|
||||||
|
assert exclude_flags == ('--keep-exclude-tags',)
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_exclude_flags_does_not_include_keep_exclude_tags_when_false_in_config():
|
||||||
|
exclude_flags = module._make_exclude_flags(location_config={'keep_exclude_tags': False})
|
||||||
|
|
||||||
|
assert exclude_flags == ()
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_exclude_flags_includes_exclude_nodump_when_true_in_config():
|
||||||
|
exclude_flags = module._make_exclude_flags(location_config={'exclude_nodump': True})
|
||||||
|
|
||||||
|
assert exclude_flags == ('--exclude-nodump',)
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_exclude_flags_does_not_include_exclude_nodump_when_false_in_config():
|
||||||
|
exclude_flags = module._make_exclude_flags(location_config={'exclude_nodump': False})
|
||||||
|
|
||||||
|
assert exclude_flags == ()
|
||||||
|
|
||||||
|
|
||||||
def test_make_exclude_flags_is_empty_when_config_has_no_excludes():
|
def test_make_exclude_flags_is_empty_when_config_has_no_excludes():
|
||||||
exclude_flags = module._make_exclude_flags(location_config={})
|
exclude_flags = module._make_exclude_flags(location_config={})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue