Make possible to start without a details.json file

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 1c3a6d1a
......@@ -58,12 +58,19 @@ def is_root_valid(path):
print('There is a branches file conflicting with the expected directory')
return False
# TODO make possible to start without these two files
required_files = ["config.json", "details.json"]
for file in required_files:
file = path / file
if not (file.exists() and file.is_file()):
print("The required file %s does not exist" % file)
return False
# details.json file
file = path / 'details.json'
if not file.exists():
with open(file, 'w') as f:
f.write('{"branches":{}}')
elif not file.is_file():
print('There is a details.json non-file conflicting with the expectations.')
return False
# TODO make possible to start without this file
file = path / 'config.json'
if not (file.exists() and file.is_file()):
print("The required file %s does not exist" % file)
return False
return True
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