From 1ad3f7b51669c752bc47137fcb16a4b165dfca6e Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 22 Jan 2020 13:33:19 +0100 Subject: [PATCH] fix not aborting overwrite dialog --- CHANGELOG.md | 1 + ansibledoctor/DocumentationGenerator.py | 6 ++++-- ansibledoctor/Utils.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ed0e7..5c888f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ansibledoctor/DocumentationGenerator.py b/ansibledoctor/DocumentationGenerator.py index f6b4141..ecabdd6 100644 --- a/ansibledoctor/DocumentationGenerator.py +++ b/ansibledoctor/DocumentationGenerator.py @@ -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: diff --git a/ansibledoctor/Utils.py b/ansibledoctor/Utils.py index 7577c73..ad18251 100644 --- a/ansibledoctor/Utils.py +++ b/ansibledoctor/Utils.py @@ -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)