[master/rhel7-branch] Error gracefully if we have a question in cmdline mode. (#869731)

Samantha N. Bueno sbueno+anaconda at redhat.com
Wed Jan 8 16:51:27 UTC 2014


On Wed, Jan 08, 2014 at 10:16:52AM +0100, Vratislav Podzimek wrote:
> 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.

Yeah, I was very iffy about that as well. None of the other base
exceptions look good to raise if we run into the "can't have a question
in cmdline mode" issue. I was on the fence about creating a new
exception class just for that, but it might be the safest way to go.
I'll go ahead and do that then.
 
> > +
> > +            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.

Yeah, not a big fan of the sleep, but I'm operating on the idea that
cmdline = no user interaction whatsoever. The message window does
technically require some user interaction to acknowledge you've seen the
error and are ready to exit the installer.

Also cmdline mode = no graphical interface, so we can't really show a
message window.

Samantha

 
> > +            # 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
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list