Support for Borg --files-cache option for setting the files cache operation mode.

This commit is contained in:
Dan 2017-11-02 22:03:11 -07:00
parent f83346b9b3
commit fc3b1fccba
4 changed files with 29 additions and 1 deletions

1
NEWS
View File

@ -2,6 +2,7 @@
* Pass several Unix signals through to child processes like Borg. This means that Borg now properly
shuts down if borgmatic is terminated (e.g. due to a system suspend).
* #29: Support for using tilde in repository paths to reference home directory.
* #42: Support for Borg --files-cache option for setting the files cache operation mode.
1.1.9
* #16, #38: Support for user-defined hooks before/after backup, or on error.

View File

@ -84,6 +84,8 @@ def create_archive(
umask = storage_config.get('umask', None)
umask_flags = ('--umask', str(umask)) if umask else ()
one_file_system_flags = ('--one-file-system',) if location_config.get('one_file_system') else ()
files_cache = location_config.get('files_cache')
files_cache_flags = ('--files-cache', files_cache) if files_cache else ()
remote_path = location_config.get('remote_path')
remote_path_flags = ('--remote-path', remote_path) if remote_path else ()
verbosity_flags = {
@ -99,7 +101,7 @@ def create_archive(
repository=repository,
archive_name_format=archive_name_format,
),
) + sources + exclude_flags + compression_flags + one_file_system_flags + \
) + sources + exclude_flags + compression_flags + one_file_system_flags + files_cache_flags + \
remote_path_flags + umask_flags + verbosity_flags
subprocess.check_call(full_command)

View File

@ -22,6 +22,12 @@ map:
type: bool
desc: Stay in same file system (do not cross mount points).
example: true
files_cache:
type: scalar
desc: Mode in which to operate the files cache. See
https://borgbackup.readthedocs.io/en/stable/usage/create.html#description for
details.
example: ctime,size,inode
remote_path:
type: scalar
desc: Alternate Borg remote executable. Defaults to "borg".

View File

@ -250,6 +250,25 @@ def test_create_archive_with_one_file_system_calls_borg_with_one_file_system_par
)
def test_create_archive_with_files_cache_calls_borg_with_files_cache_parameters():
flexmock(module).should_receive('_expand_directory').and_return(['foo']).and_return(['bar'])
flexmock(module).should_receive('_write_exclude_file').and_return(None)
flexmock(module).should_receive('_make_exclude_flags').and_return(())
insert_subprocess_mock(CREATE_COMMAND + ('--files-cache', 'ctime,size'))
module.create_archive(
verbosity=None,
repository='repo',
location_config={
'source_directories': ['foo', 'bar'],
'repositories': ['repo'],
'files_cache': 'ctime,size',
'exclude_patterns': None,
},
storage_config={},
)
def test_create_archive_with_remote_path_calls_borg_with_remote_path_parameters():
flexmock(module).should_receive('_expand_directory').and_return(['foo']).and_return(['bar'])
flexmock(module).should_receive('_write_exclude_file').and_return(None)