Use the --force option for every question.

fix #12
This commit is contained in:
Antoine Nguyen
2016-06-07 10:05:16 +02:00
parent eb780d3f58
commit b20400fd98
3 changed files with 16 additions and 13 deletions

View File

@@ -61,15 +61,16 @@ class Modoboa(base.Installer):
"""Deploy Modoboa."""
target = os.path.join(self.home_dir, "instance")
if os.path.exists(target):
utils.printcolor(
"Target directory for Modoboa deployment ({}) already exists."
" If you choose to continue, it will be removed.".format(
target),
utils.YELLOW
)
answer = utils.user_input("Do you confirm? (Y/n) ")
if answer.lower().startswith("n"):
return
if not self.config.getboolean("general", "force"):
utils.printcolor(
"Target directory for Modoboa deployment ({}) already "
"exists. If you choose to continue, it will be removed."
.format(target),
utils.YELLOW
)
answer = utils.user_input("Do you confirm? (Y/n) ")
if answer.lower().startswith("n"):
return
shutil.rmtree(target)
prefix = ". {}; ".format(