better error msg for defect or unsupported repo configs, fixes #6566

This commit is contained in:
Thomas Waldmann 2022-04-18 09:16:16 +02:00
parent d2c22633e8
commit 1aba534c5a
1 changed files with 5 additions and 2 deletions

View File

@ -446,11 +446,14 @@ class Repository:
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()