add BORG_USE_CHUNKS_ARCHIVE

This commit is contained in:
Vandal
2025-04-20 09:58:09 +05:30
parent 620bf52e01
commit 2078527539
3 changed files with 20 additions and 0 deletions
+3
View File
@@ -79,6 +79,9 @@ def make_environment(config):
os.set_inheritable(read_file_descriptor, True)
environment['BORG_PASSPHRASE_FD'] = str(read_file_descriptor)
if 'use_chunks_archive' in config:
environment['BORG_USE_CHUNKS_ARCHIVE'] = 'yes' if config.get('use_chunks_archive') else 'no'
for (
option_name,
environment_variable_name,
+7
View File
@@ -389,6 +389,13 @@ properties:
Path for Borg cache files. Defaults to
$borg_base_directory/.cache/borg
example: /path/to/base/cache
use_chunks_archive:
type: boolean
description: |
Enables or disables the use of chunks.archive.d for faster cache
resyncs in Borg. If true, value is set to "yes" (default) else
it's set to "no", reducing disk usage but slowing resyncs.
default: true
borg_files_cache_ttl:
type: integer
description: |
+10
View File
@@ -170,3 +170,13 @@ def test_make_environment_with_integer_variable_value():
environment = module.make_environment({'borg_files_cache_ttl': 40})
assert environment.get('BORG_FILES_CACHE_TTL') == '40'
def test_make_environment_with_use_chunks_archive_should_set_correct_environment_value():
flexmock(module.os).should_receive('environ').and_return({'USER': 'root'})
environment = module.make_environment({'use_chunks_archive': True})
assert environment.get('BORG_USE_CHUNKS_ARCHIVE') == 'yes'
environment = module.make_environment({'use_chunks_archive': False})
assert environment.get('BORG_USE_CHUNKS_ARCHIVE') == 'no'