fix not aborting overwrite dialog

This commit is contained in:
Robert Kaussow 2020-01-22 13:33:19 +01:00
parent 97d39351e4
commit 1ad3f7b516
3 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,5 @@
* BUGFIX
* add `role_name` config option to overwrite name of the role
* fix not aborting overwrite dialog
* FEATURE
* add basic hugo theme

View File

@ -88,8 +88,10 @@ class Generator:
print(*files_to_overwite, sep="\n")
try:
FileUtils.query_yes_no("Do you want to continue?")
except ansibledoctor.Exception.InputError:
if not FileUtils.query_yes_no("Do you want to continue?"):
self.log.sysexit_with_message("Aborted...")
except ansibledoctor.Exception.InputError as e:
self.logger.debug(str(e))
self.log.sysexit_with_message("Aborted...")
for file in self.template_files:

View File

@ -215,6 +215,6 @@ class FileUtils:
try:
# input() is safe in python3
choice = input("{} {} ".format(question, prompt)) or default # nosec
to_bool(choice)
return to_bool(choice)
except (KeyboardInterrupt, ValueError) as e:
raise ansibledoctor.Exception.InputError("Error while reading input", e)