1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +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) raise self.InvalidRepository(self.path)
if 'repository' not in self.config.sections(): if 'repository' not in self.config.sections():
self.close() self.close()
raise self.InvalidRepository(path) raise self.InvalidRepositoryConfig(path, 'no repository section found')
self.version = self.config.getint('repository', 'version') self.version = self.config.getint('repository', 'version')
if self.version not in (2, ): # for now, only work on new repos if self.version not in (2, ): # for now, only work on new repos
self.close() 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')) self.max_segment_size = parse_file_size(self.config.get('repository', 'max_segment_size'))
if self.max_segment_size >= MAX_SEGMENT_SIZE_LIMIT: if self.max_segment_size >= MAX_SEGMENT_SIZE_LIMIT:
self.close() self.close()