[master/rhel7-branch] Error gracefully if we have a question in cmdline mode. (#869731)
Vratislav Podzimek
vpodzime at redhat.com
Wed Jan 8 09:16:52 UTC 2014
On Tue, 2014-01-07 at 11:58 -0500, Samantha N. Bueno wrote:
> Show a nice error message before bailing instead of just crashing.
>
> Resolves: rhbz#869731
> ---
> pyanaconda/exception.py | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
> index a32f318..59ebbb6 100644
> --- a/pyanaconda/exception.py
> +++ b/pyanaconda/exception.py
> @@ -90,6 +90,19 @@ class AnacondaExceptionHandler(ExceptionHandler):
> "The installer will now terminate.") % str(value)
> self.intf.messageWindow(_("Hardware error occured"), hw_error_msg)
> sys.exit(0)
> + elif (issubclass (ty, RuntimeError) and not flags.flags.ksprompt):
I'm not sure doing this for all RuntimeError subclasses' instances is a
good idea. We should have a special exception class for such errors.
> +
> + cmdline_error_msg = _("\nThe installation was stopped due to "
> + "incomplete spokes detected while running "
> + "in non-interactive cmdline mode. Since there "
> + "can not be any questions in cmdline mode, "
> + "edit your kickstart file and retry "
> + "installation.\nThe exact error message is: "
> + "\n\n%s.\n\nThe installer will now terminate.") % str(value)
> + print cmdline_error_msg
Any reason for not using self.intf.messageWindow() just like HW errors
do? It would allow you to remove that ugly sleep below.
> + # sleep for a bit so the error message has a chance of being seen
> + time.sleep(10)
> + sys.exit(0)
> else:
> try:
> # pylint: disable-msg=E0611
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list