Support borg create --umask. (Merge PR from ypid.)
This commit is contained in:
parent
d6585811d6
commit
dd2be365b1
5 changed files with 23 additions and 1 deletions
1
NEWS
1
NEWS
|
@ -2,6 +2,7 @@
|
|||
|
||||
* Fixed handling of repeated spaces in source_directories which resulted in backup up everything.
|
||||
* Added support for --one-file-system for Borg.
|
||||
* Support borg create --umask.
|
||||
|
||||
0.1.7
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ CONFIG_FORMAT = (
|
|||
(
|
||||
option('encryption_passphrase', required=False),
|
||||
option('compression', required=False),
|
||||
option('umask', required=False),
|
||||
),
|
||||
),
|
||||
shared.CONFIG_FORMAT[2], # retention
|
||||
|
@ -34,6 +35,7 @@ CONFIG_FORMAT = (
|
|||
|
||||
|
||||
initialize = partial(shared.initialize, command=COMMAND)
|
||||
|
||||
create_archive = partial(shared.create_archive, command=COMMAND)
|
||||
prune_archives = partial(shared.prune_archives, command=COMMAND)
|
||||
check_archives = partial(shared.check_archives, command=COMMAND)
|
||||
|
|
|
@ -69,6 +69,8 @@ def create_archive(
|
|||
exclude_flags = ('--exclude-from', excludes_filename) if excludes_filename else ()
|
||||
compression = storage_config.get('compression', None)
|
||||
compression_flags = ('--compression', compression) if compression else ()
|
||||
umask = storage_config.get('umask', None)
|
||||
umask_flags = ('--umask', str(umask)) if umask else ()
|
||||
one_file_system_flags = ('--one-file-system',) if one_file_system else ()
|
||||
verbosity_flags = {
|
||||
VERBOSITY_SOME: ('--stats',),
|
||||
|
@ -83,7 +85,7 @@ def create_archive(
|
|||
timestamp=datetime.now().isoformat(),
|
||||
),
|
||||
) + sources + exclude_flags + compression_flags + one_file_system_flags + \
|
||||
verbosity_flags
|
||||
umask_flags + verbosity_flags
|
||||
|
||||
subprocess.check_call(full_command)
|
||||
|
||||
|
|
|
@ -162,6 +162,21 @@ def test_create_archive_with_one_file_system_should_call_attic_with_one_file_sys
|
|||
)
|
||||
|
||||
|
||||
def test_create_archive_with_umask_should_call_attic_with_umask_parameters():
|
||||
insert_subprocess_mock(CREATE_COMMAND + ('--umask', '740'))
|
||||
insert_platform_mock()
|
||||
insert_datetime_mock()
|
||||
|
||||
module.create_archive(
|
||||
excludes_filename='excludes',
|
||||
verbosity=None,
|
||||
storage_config={'umask': 740},
|
||||
source_directories='foo bar',
|
||||
repository='repo',
|
||||
command='attic',
|
||||
)
|
||||
|
||||
|
||||
BASE_PRUNE_FLAGS = (
|
||||
('--keep-daily', '1'),
|
||||
('--keep-weekly', '2'),
|
||||
|
|
|
@ -17,6 +17,8 @@ repository: user@backupserver:sourcehostname.attic
|
|||
# archives. See https://borgbackup.github.io/borgbackup/usage.html#borg-create
|
||||
# for details. Defaults to no compression.
|
||||
#compression: lz4
|
||||
# For Borg only, you can specify the umask to be used for borg create.
|
||||
#umask: 0740
|
||||
|
||||
[retention]
|
||||
# Retention policy for how many backups to keep in each category. See
|
||||
|
|
Loading…
Reference in a new issue