Alex Lourie has uploaded a new change for review. Change subject: packaging: Added a functionality for interaction with user ......................................................................
packaging: Added a functionality for interaction with user Added a function askYesNoContinue to common_utils. This allows creating installation flows with answers additional to standard 'yes' and 'no'. Change-Id: Ibdd343015a35d8558548ba1a66874776e3828b0e Signed-off-by: Alex Lourie <alou...@redhat.com> --- M packaging/fedora/setup/common_utils.py 1 file changed, 18 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/8703/1 diff --git a/packaging/fedora/setup/common_utils.py b/packaging/fedora/setup/common_utils.py index 7097a94..b2aea48 100755 --- a/packaging/fedora/setup/common_utils.py +++ b/packaging/fedora/setup/common_utils.py @@ -903,6 +903,24 @@ else: return askYesNo(question) +def askYesNoContinue(question=None): + message = StringIO() + askString = "%s? (yes|no|continue): "%(question) + logging.debug("asking user: %s"%askString) + message.write(askString) + message.seek(0) + rawAnswer = raw_input(message.read()) + logging.debug("user answered: %s"%(rawAnswer)) + answer = rawAnswer.lower() + if answer == "yes" or answer == "y": + return 'y' + elif answer == "no" or answer == "n": + return 'n' + elif answer == "continue" or answer == "c": + return 'c' + else: + return askYesNoContinue(question) + def retry(func, expectedException=Exception, tries=None, timeout=None, sleep=1): """ Retry a function. Wraps the retry logic so you don't have to -- To view, visit http://gerrit.ovirt.org/8703 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibdd343015a35d8558548ba1a66874776e3828b0e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alex Lourie <alou...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches