Fix for traceback when "exclude_from" value is empty in configuration file.
This commit is contained in:
parent
d127e73590
commit
3af92f8b92
3 changed files with 12 additions and 1 deletions
1
NEWS
1
NEWS
|
@ -1,5 +1,6 @@
|
||||||
1.1.7.dev0
|
1.1.7.dev0
|
||||||
|
|
||||||
|
* Fix for traceback when "exclude_from" value is empty in configuration file.
|
||||||
* When pruning, make highest verbosity level list archives kept and pruned.
|
* When pruning, make highest verbosity level list archives kept and pruned.
|
||||||
* Clarification of Python 3 pip usage in documentation.
|
* Clarification of Python 3 pip usage in documentation.
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ def _make_exclude_flags(location_config, exclude_patterns_filename=None):
|
||||||
Given a location config dict with various exclude options, and a filename containing any exclude
|
Given a location config dict with various exclude options, and a filename containing any exclude
|
||||||
patterns, return the corresponding Borg flags as a tuple.
|
patterns, return the corresponding Borg flags as a tuple.
|
||||||
'''
|
'''
|
||||||
exclude_filenames = tuple(location_config.get('exclude_from', ())) + (
|
exclude_filenames = tuple(location_config.get('exclude_from') or ()) + (
|
||||||
(exclude_patterns_filename,) if exclude_patterns_filename else ()
|
(exclude_patterns_filename,) if exclude_patterns_filename else ()
|
||||||
)
|
)
|
||||||
exclude_from_flags = tuple(
|
exclude_from_flags = tuple(
|
||||||
|
|
|
@ -88,6 +88,16 @@ def test_make_exclude_flags_includes_both_filenames_when_patterns_given_and_excl
|
||||||
assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from', '/tmp/excludes')
|
assert exclude_flags == ('--exclude-from', 'excludes', '--exclude-from', '/tmp/excludes')
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_exclude_flags_considers_none_exclude_from_filenames_as_empty():
|
||||||
|
flexmock(module).should_receive('_write_exclude_file').and_return(None)
|
||||||
|
|
||||||
|
exclude_flags = module._make_exclude_flags(
|
||||||
|
location_config={'exclude_from': None},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert exclude_flags == ()
|
||||||
|
|
||||||
|
|
||||||
def test_make_exclude_flags_includes_exclude_caches_when_true_in_config():
|
def test_make_exclude_flags_includes_exclude_caches_when_true_in_config():
|
||||||
exclude_flags = module._make_exclude_flags(
|
exclude_flags = module._make_exclude_flags(
|
||||||
location_config={'exclude_caches': True},
|
location_config={'exclude_caches': True},
|
||||||
|
|
Loading…
Reference in a new issue