From cdaffff03bb7d9bc747ccb6ed59e478354f00281 Mon Sep 17 00:00:00 2001 From: Daniele Rondina Date: Sun, 24 Feb 2019 11:42:02 +0100 Subject: [PATCH] Improve equo generate subcommand for CI Add option --force-non-interactive to generate sub command to avoid use of expect tool. --- client/solo/commands/rescue.py | 37 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/client/solo/commands/rescue.py b/client/solo/commands/rescue.py index 93f0f60c5..832307a8e 100644 --- a/client/solo/commands/rescue.py +++ b/client/solo/commands/rescue.py @@ -107,6 +107,12 @@ Tools to rescue the running system. help=_("re-generate the installed packages repository" " using the Source Package Manager")) generate_parser.set_defaults(func=self._generate) + generate_parser.add_argument( + "--force-non-interactive", + action="store_true", + default=False, + help=("Do not ask for confirmation (caution: resets" + " packages database).")) _commands["generate"] = {} spmuids_parser = subparsers.add_parser( @@ -329,21 +335,22 @@ Tools to rescue the running system. level="warning", importance=1) - rc = entropy_client.ask_question( - " %s" % (_("Understood ?"),)) - if rc == _("No"): - return 1 - rc = entropy_client.ask_question( - " %s" % (_("Really ?"),) ) - if rc == _("No"): - return 1 - rc = entropy_client.ask_question( - " %s. %s" % ( - _("This is your last chance"), - _("Ok?"),) - ) - if rc == _("No"): - return 1 + if not self._nsargs.force_non_interactive: + rc = entropy_client.ask_question( + " %s" % (_("Understood ?"),)) + if rc == _("No"): + return 1 + rc = entropy_client.ask_question( + " %s" % (_("Really ?"),) ) + if rc == _("No"): + return 1 + rc = entropy_client.ask_question( + " %s. %s" % ( + _("This is your last chance"), + _("Ok?"),) + ) + if rc == _("No"): + return 1 # clean caches spm = entropy_client.Spm()