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

Anne Mulhern amulhern at redhat.com
Tue Jan 7 20:26:25 UTC 2014





----- Original Message -----
> From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Tuesday, January 7, 2014 3:06:17 PM
> Subject: Re: [master/rhel7-branch] Error gracefully if we have a question in	cmdline mode. (#869731)
> 
> On Tue, Jan 07, 2014 at 12:46:12PM -0500, Anne Mulhern wrote:
> > ----- Original Message -----
> > > From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> > > To: anaconda-patches at lists.fedorahosted.org
> > > Sent: Tuesday, January 7, 2014 11:58:46 AM
> > > Subject: [master/rhel7-branch] Error gracefully if we have a question in
> > > 	cmdline mode. (#869731)
> > > 
> > > 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):
> > > +
> > > +            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
> > > +            # 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
> > > --
> > > 1.8.3.1
> > 
> > 
> > The print call is missing parentheses, but I can't see anything else.
> 
> Hm, I thought it wasn't needed since cmdline_error_msg is already
> defined above with the appropriate translation markers.
> 

I don't think that what the cmdline_error_msg is is relevant (although somebody who knows more about translation might be able to tell me otherwise).

I'm only worried about Python 3 compatibility since print the command will go away entirely, then.

- mulhern

> Samantha
> _______________________________________________
> 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