Merge pull request 'Log warning for excluding special files only if list is not empty' (#629) from palto42/borgmatic:special_files_warn into master
Reviewed-on: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls/629
This commit is contained in:
commit
6c4abb6803
2 changed files with 12 additions and 13 deletions
|
@ -430,18 +430,17 @@ def create_archive(
|
||||||
borg_environment,
|
borg_environment,
|
||||||
skip_directories=borgmatic_source_directories,
|
skip_directories=borgmatic_source_directories,
|
||||||
)
|
)
|
||||||
logger.warning(
|
|
||||||
f'{repository}: Excluding special files to prevent Borg from hanging: {", ".join(special_file_paths)}'
|
|
||||||
)
|
|
||||||
|
|
||||||
exclude_file = write_pattern_file(
|
if special_file_paths:
|
||||||
expand_home_directories(
|
logger.warning(
|
||||||
tuple(location_config.get('exclude_patterns') or ()) + special_file_paths
|
f'{repository}: Excluding special files to prevent Borg from hanging: {", ".join(special_file_paths)}'
|
||||||
),
|
)
|
||||||
pattern_file=exclude_file,
|
exclude_file = write_pattern_file(
|
||||||
)
|
expand_home_directories(
|
||||||
|
tuple(location_config.get('exclude_patterns') or ()) + special_file_paths
|
||||||
if exclude_file:
|
),
|
||||||
|
pattern_file=exclude_file,
|
||||||
|
)
|
||||||
create_command += make_exclude_flags(location_config, exclude_file.name)
|
create_command += make_exclude_flags(location_config, exclude_file.name)
|
||||||
|
|
||||||
create_command += (
|
create_command += (
|
||||||
|
|
|
@ -1790,7 +1790,7 @@ def test_create_archive_with_stream_processes_ignores_read_special_false_and_log
|
||||||
flexmock(module).should_receive('pattern_root_directories').and_return([])
|
flexmock(module).should_receive('pattern_root_directories').and_return([])
|
||||||
flexmock(module.os.path).should_receive('expanduser').and_raise(TypeError)
|
flexmock(module.os.path).should_receive('expanduser').and_raise(TypeError)
|
||||||
flexmock(module).should_receive('expand_home_directories').and_return(())
|
flexmock(module).should_receive('expand_home_directories').and_return(())
|
||||||
flexmock(module).should_receive('write_pattern_file').and_return(None)
|
flexmock(module).should_receive('write_pattern_file').and_return(flexmock(name='/tmp/excludes'))
|
||||||
flexmock(module.feature).should_receive('available').and_return(True)
|
flexmock(module.feature).should_receive('available').and_return(True)
|
||||||
flexmock(module).should_receive('ensure_files_readable')
|
flexmock(module).should_receive('ensure_files_readable')
|
||||||
flexmock(module.logger).should_receive('warning').twice()
|
flexmock(module.logger).should_receive('warning').twice()
|
||||||
|
@ -1800,7 +1800,7 @@ def test_create_archive_with_stream_processes_ignores_read_special_false_and_log
|
||||||
(f'repo::{DEFAULT_ARCHIVE_NAME}',)
|
(f'repo::{DEFAULT_ARCHIVE_NAME}',)
|
||||||
)
|
)
|
||||||
flexmock(module.environment).should_receive('make_environment')
|
flexmock(module.environment).should_receive('make_environment')
|
||||||
flexmock(module).should_receive('collect_special_file_paths').and_return(())
|
flexmock(module).should_receive('collect_special_file_paths').and_return(("/dev/null",))
|
||||||
create_command = (
|
create_command = (
|
||||||
'borg',
|
'borg',
|
||||||
'create',
|
'create',
|
||||||
|
|
Loading…
Reference in a new issue