Installer upgrade mode.

This commit is contained in:
Antoine Nguyen
2019-03-19 10:49:27 +01:00
parent 409bbbfc8a
commit 503145eaad
14 changed files with 167 additions and 68 deletions

View File

@@ -145,10 +145,15 @@ def copy_from_template(template, dest, context):
fp.write(ConfigFileTemplate(buf).substitute(context))
def check_config_file(dest, interactive=False):
def check_config_file(dest, interactive=False, upgrade=False):
"""Create a new installer config file if needed."""
if os.path.exists(dest):
return
if upgrade:
printcolor(
"You cannot upgrade an existing installation without a "
"configuration file.", RED)
sys.exit(1)
printcolor(
"Configuration file {} not found, creating new one."
.format(dest), YELLOW)