[PATCH 1/2] Always store the information about display mode in ksdata

Vratislav Podzimek vpodzime at redhat.com
Fri Oct 10 12:08:08 UTC 2014


On Wed, 2014-10-08 at 14:55 -0400, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Wednesday, October 8, 2014 4:55:39 AM
> > Subject: [PATCH 1/2] Always store the information about display mode in ksdata
> > 
> > Once we know in which mode we are going to run we should store that
> > information
> > in ksdata.displaymode so that other parts of the code can make use of it.
> > 
> > Related: rhbz#1073679
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  anaconda | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/anaconda b/anaconda
> > index 4b6c29a..56c4b95 100755
> > --- a/anaconda
> > +++ b/anaconda
> > @@ -1054,16 +1054,16 @@ if __name__ == "__main__":
> >      # now start the interface
> >      setupDisplay(anaconda, opts, addon_paths)
> >  
> > +    # we now know in which mode we are going to run so store the information
> > +    from pykickstart.constants import DISPLAY_MODE_GRAPHICAL,
> > DISPLAY_MODE_CMDLINE, DISPLAY_MODE_TEXT
> > +    mode_char_to_const = {'g': DISPLAY_MODE_GRAPHICAL, 't':
> > DISPLAY_MODE_TEXT, 'c': DISPLAY_MODE_CMDLINE}
> > +    ksdata.displaymode.displayMode =
> > mode_char_to_const[anaconda.displayMode]
> > +
> >      # if we're in text mode, the resulting system should be too
> >      # ...unless the kickstart specified otherwise
> >      if anaconda.displayMode != 'g':
> > -        if not anaconda.ksdata.xconfig.startX:
> > -            anaconda.ksdata.skipx.skipx = True
> > -        from pykickstart.constants import DISPLAY_MODE_CMDLINE,
> > DISPLAY_MODE_TEXT
> > -        if anaconda.displayMode == 'c':
> > -            anaconda.ksdata.displaymode.displayMode = DISPLAY_MODE_CMDLINE
> > -        else:
> > -            anaconda.ksdata.displaymode.displayMode = DISPLAY_MODE_TEXT
> > +        if not ksdata.xconfig.startX:
> > +            ksdata.skipx.skipx = True
> >  
> 
> Since the rest of the body of the if statement is empty after change, might as well compress to:
> 
> if anaconda.displayMode != 'g' and not ksdata.xconfig.startX:
>     ksdata.skipx.skipx = True
Good point. And I like this one more. Fixing locally.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list