mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-15 10:56:30 +00:00
Merge pull request #4461 from user062/patch-2
give invalid repo error msg if repo config not found, fixes #4411
This commit is contained in:
commit
8c4cedc7f4
1 changed files with 6 additions and 2 deletions
|
@ -393,8 +393,12 @@ def open(self, path, exclusive, lock_wait=None, lock=True):
|
||||||
else:
|
else:
|
||||||
self.lock = None
|
self.lock = None
|
||||||
self.config = ConfigParser(interpolation=None)
|
self.config = ConfigParser(interpolation=None)
|
||||||
with open(os.path.join(self.path, 'config')) as fd:
|
try:
|
||||||
self.config.read_file(fd)
|
with open(os.path.join(self.path, 'config')) as fd:
|
||||||
|
self.config.read_file(fd)
|
||||||
|
except FileNotFoundError:
|
||||||
|
self.close()
|
||||||
|
raise self.InvalidRepository(self.path)
|
||||||
if 'repository' not in self.config.sections() or self.config.getint('repository', 'version') != 1:
|
if 'repository' not in self.config.sections() or self.config.getint('repository', 'version') != 1:
|
||||||
self.close()
|
self.close()
|
||||||
raise self.InvalidRepository(path)
|
raise self.InvalidRepository(path)
|
||||||
|
|
Loading…
Reference in a new issue