mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-09 13:53:09 +00:00
Fix backwards compatibility of old chunks.archive.d file behavior
In case a file named chunks.archive.d, cache would not create a folder with that name to store cache chunks archive. We need to support both the new environment variable and the old "hacky" way of creating a file.
This commit is contained in:
parent
2c364fca40
commit
924952fcdd
1 changed files with 7 additions and 1 deletions
|
@ -478,7 +478,6 @@ class LocalCache(CacheStatsMixin):
|
|||
self.consider_part_files = consider_part_files
|
||||
self.timestamp = None
|
||||
self.txn_active = False
|
||||
self.do_cache = os.environ.get("BORG_USE_CHUNKS_ARCHIVE", "yes").lower() in ["yes", "1", "true"]
|
||||
|
||||
self.path = cache_dir(repository, path)
|
||||
self.security_manager = SecurityManager(repository)
|
||||
|
@ -495,6 +494,13 @@ class LocalCache(CacheStatsMixin):
|
|||
self.wipe_cache()
|
||||
self.open()
|
||||
|
||||
# new way: tell whether to use the chunks archive via an environment variable:
|
||||
do_cache_env = os.environ.get("BORG_USE_CHUNKS_ARCHIVE", "yes").lower() in ["yes", "1", "true"]
|
||||
# backwards compatibility: a user might have replaced the archive_path directory with
|
||||
# a regular file (as documented in the borg FAQ) to avoid chunks archive creation:
|
||||
do_cache_fs = os.path.isdir(os.path.join(self.path, "chunks.archive.d"))
|
||||
self.do_cache = do_cache_env and do_cache_fs
|
||||
|
||||
try:
|
||||
self.security_manager.assert_secure(manifest, key, cache_config=self.cache_config)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue