Commit cd25203c authored by Mattia Rizzolo's avatar Mattia Rizzolo

Make possible to start without a branches dir

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent ed9c1f9c
# A program which manages Ubuntu-it's web test server # A program which manages Ubuntu-it's web test server
# Copyright (C) 2015 Pietro Albini <pietroalbini@ubuntu.com> # Copyright (C) 2015 Pietro Albini <pietroalbini@ubuntu.com>
# © 2019 Mattia Rizzolo <mapreri@ubuntu.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published # it under the terms of the GNU Affero General Public License as published
...@@ -25,15 +26,18 @@ def is_root_valid(path): ...@@ -25,15 +26,18 @@ def is_root_valid(path):
path = pathlib.Path(path) path = pathlib.Path(path)
if not (path.exists() and path.is_dir()): if not (path.exists() and path.is_dir()):
print(")he specified root directory doesn't exist, please create it.")
return False return False
required_dirs = ["branches"]
required_files = ["config.json", "details.json", "version"] required_files = ["config.json", "details.json", "version"]
for dir in required_dirs: # make sure a branches directory is available:
dir = path / dir dir = path / 'branches'
if not (dir.exists() and dir.is_dir()): if not dir.exists():
print("The required directory %s does not exist" % dir) print('Creating the branches directory...')
dir.mkdir()
elif not dir.is_dir():
print('There is a branches file conflicting with the expected directory')
return False return False
for file in required_files: for file in required_files:
......
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