1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 01:06:50 +00:00

Merge pull request #6619 from ThomasWaldmann/invalid-repo-msg-master

better error msg for defect or unsupported repo configs, fixes #6566
This commit is contained in:
TW 2022-04-18 09:53:09 +02:00 committed by GitHub
commit 299196ebcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -446,11 +446,14 @@ def open(self, path, exclusive, lock_wait=None, lock=True):
raise self.InvalidRepository(self.path)
if 'repository' not in self.config.sections():
self.close()
raise self.InvalidRepository(path)
raise self.InvalidRepositoryConfig(path, 'no repository section found')
self.version = self.config.getint('repository', 'version')
if self.version not in (2, ): # for now, only work on new repos
self.close()
raise self.InvalidRepository(path)
raise self.InvalidRepositoryConfig(
path,
'repository version %d is not supported by this borg version' % self.version
)
self.max_segment_size = parse_file_size(self.config.get('repository', 'max_segment_size'))
if self.max_segment_size >= MAX_SEGMENT_SIZE_LIMIT:
self.close()