Commit a3d0bf91 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos/collect: Check if directory exists before continue

parent 00f8918f
......@@ -123,6 +123,10 @@ class Database:
def __init__(self, directory = None, create = True, timeout=None):
assert self.database_name is not None
if directory.endswith(self.database_name):
directory = directory[:-len(self.database_name)]
if not os.path.exists(directory):
raise ValueError("%s don't exist" % directory)
self.uri = os.path.join(directory, self.database_name)
self.connection = None
self.cursor = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment