In the "spot" check, don't try to hash symlinked directories.
This commit is contained in:
parent
c58f510054
commit
08d6f83b2e
3 changed files with 15 additions and 14 deletions
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@
|
||||||
the log level.
|
the log level.
|
||||||
* #874: Add the configured repository label as "repository_label" to the interpolated variables
|
* #874: Add the configured repository label as "repository_label" to the interpolated variables
|
||||||
passed to before/after command hooks.
|
passed to before/after command hooks.
|
||||||
|
* In the "spot" check, don't try to hash symlinked directories.
|
||||||
|
|
||||||
1.8.11
|
1.8.11
|
||||||
* #815: Add optional Healthchecks auto-provisioning via "create_slug" option.
|
* #815: Add optional Healthchecks auto-provisioning via "create_slug" option.
|
||||||
|
|
|
@ -300,8 +300,7 @@ def collect_spot_check_source_paths(
|
||||||
'''
|
'''
|
||||||
Given a repository configuration dict, a configuration dict, the local Borg version, global
|
Given a repository configuration dict, a configuration dict, the local Borg version, global
|
||||||
arguments as an argparse.Namespace instance, the local Borg path, and the remote Borg path,
|
arguments as an argparse.Namespace instance, the local Borg path, and the remote Borg path,
|
||||||
collect the source paths that Borg would use in an actual create (but only include files and
|
collect the source paths that Borg would use in an actual create (but only include files).
|
||||||
symlinks).
|
|
||||||
'''
|
'''
|
||||||
stream_processes = any(
|
stream_processes = any(
|
||||||
borgmatic.hooks.dispatch.call_hooks(
|
borgmatic.hooks.dispatch.call_hooks(
|
||||||
|
@ -349,7 +348,7 @@ def collect_spot_check_source_paths(
|
||||||
if path_line and path_line.startswith('- ') or path_line.startswith('+ ')
|
if path_line and path_line.startswith('- ') or path_line.startswith('+ ')
|
||||||
)
|
)
|
||||||
|
|
||||||
return tuple(path for path in paths if os.path.isfile(path) or os.path.islink(path))
|
return tuple(path for path in paths if os.path.isfile(path))
|
||||||
|
|
||||||
|
|
||||||
BORG_DIRECTORY_FILE_TYPE = 'd'
|
BORG_DIRECTORY_FILE_TYPE = 'd'
|
||||||
|
|
|
@ -520,7 +520,7 @@ def test_collect_spot_check_source_paths_without_working_directory_parses_borg_o
|
||||||
) == ('/etc/path', '/etc/other')
|
) == ('/etc/path', '/etc/other')
|
||||||
|
|
||||||
|
|
||||||
def test_collect_spot_check_source_paths_includes_symlinks_but_skips_directories():
|
def test_collect_spot_check_source_paths_skips_directories():
|
||||||
flexmock(module.borgmatic.hooks.dispatch).should_receive('call_hooks').and_return(
|
flexmock(module.borgmatic.hooks.dispatch).should_receive('call_hooks').and_return(
|
||||||
{'hook1': False, 'hook2': True}
|
{'hook1': False, 'hook2': True}
|
||||||
)
|
)
|
||||||
|
@ -546,18 +546,19 @@ def test_collect_spot_check_source_paths_includes_symlinks_but_skips_directories
|
||||||
'warning: stuff\n- /etc/path\n+ /etc/dir\n? /nope',
|
'warning: stuff\n- /etc/path\n+ /etc/dir\n? /nope',
|
||||||
)
|
)
|
||||||
flexmock(module.os.path).should_receive('isfile').with_args('/etc/path').and_return(False)
|
flexmock(module.os.path).should_receive('isfile').with_args('/etc/path').and_return(False)
|
||||||
flexmock(module.os.path).should_receive('islink').with_args('/etc/path').and_return(True)
|
|
||||||
flexmock(module.os.path).should_receive('isfile').with_args('/etc/dir').and_return(False)
|
flexmock(module.os.path).should_receive('isfile').with_args('/etc/dir').and_return(False)
|
||||||
flexmock(module.os.path).should_receive('islink').with_args('/etc/dir').and_return(False)
|
|
||||||
|
|
||||||
assert module.collect_spot_check_source_paths(
|
assert (
|
||||||
|
module.collect_spot_check_source_paths(
|
||||||
repository={'path': 'repo'},
|
repository={'path': 'repo'},
|
||||||
config={'working_directory': '/'},
|
config={'working_directory': '/'},
|
||||||
local_borg_version=flexmock(),
|
local_borg_version=flexmock(),
|
||||||
global_arguments=flexmock(),
|
global_arguments=flexmock(),
|
||||||
local_path=flexmock(),
|
local_path=flexmock(),
|
||||||
remote_path=flexmock(),
|
remote_path=flexmock(),
|
||||||
) == ('/etc/path',)
|
)
|
||||||
|
== ()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_collect_spot_check_archive_paths_excludes_directories():
|
def test_collect_spot_check_archive_paths_excludes_directories():
|
||||||
|
|
Loading…
Reference in a new issue