[PATCH] add the --nombr bootloader option in pykickstart

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 16 10:30:56 UTC 2014


On Tue, 2014-09-16 at 06:21 -0400, Gene Czarcinski wrote:
> On 09/16/2014 03:11 AM, Vratislav Podzimek wrote:
> > On Mon, 2014-09-15 at 16:13 -0400, Gene Czarcinski wrote:
> >> This patch is in response to RHBZ#886502.
> >>
> >> Besides being a boot-time option, add the --nombr option for kickstart's
> >> bootloader command.  If specified, then grub2 will be installed
> >> but the MBR will not be updated.
> >> ---
> >>   pykickstart/commands/bootloader.py | 10 ++++++++--
> >>   tests/commands/bootloader.py       |  1 +
> >>   2 files changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py
> >> index 0d0523e..6e479ca 100644
> >> --- a/pykickstart/commands/bootloader.py
> >> +++ b/pykickstart/commands/bootloader.py
> >> @@ -352,15 +352,21 @@ class F21_Bootloader(F19_Bootloader):
> >>           F19_Bootloader.__init__(self, writePriority, *args, **kwargs)
> >>   
> >>           self.disabled = kwargs.get("disabled", False)
> >> +        self.nombr = kwargs.get("nombr", False)
> >>   
> >>       def _getArgsAsStr(self):
> >>           if self.disabled:
> >>               return " --disabled"
> >> -        else:
> >> -            return F19_Bootloader._getArgsAsStr(self)
> >> +
> >> +        ret = F19_Bootloader._getArgsAsStr(self)
> >> +        if self.nombr:
> >> +            ret += " --nombr"
> >> +        return ret
> >>   
> >>       def _getParser(self):
> >>           op = F19_Bootloader._getParser(self)
> >>           op.add_option("--disabled", dest="disabled", action="store_true",
> >>                         default=False)
> >> +        op.add_option("--nombr", dest="nombr", action="store_true",
> >> +                      default=False)
> >>           return op
> >> diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py
> >> index 7c9378e..279f7f3 100644
> >> --- a/tests/commands/bootloader.py
> >> +++ b/tests/commands/bootloader.py
> >> @@ -170,6 +170,7 @@ class F21_TestCase(F19_TestCase):
> >>   
> >>           self.assert_parse("bootloader --disabled", "bootloader --disabled\n")
> >>           self.assert_parse("bootloader --location=mbr --disabled", "bootloader --disabled\n")
> >> +        self.assert_parse("bootloader --location=mbr --nombr", "bootloader --location=mbr --nombr\n")
> > I think you need to add some checks (and related tests) for combinations
> > that doesn't make sense -- like 'bootloader --disabled --nombr', etc.
> > Otherwise this patch looks good to me.
> >
> --disabled does not play well with others!  If --disabled is specified 
> on the bootloader command, all other options are ignored and the test 
> just before my insert shows that.  That is, if
>       "bootloader --location=mbr  --nombr  --disabled"
> is the input, then the result will be
>       "bootloader  --disabled"
I get that, but the combination of '--disabled' with anything else
should result in a KickstartValueError.

-- 
Vratislav Podzimek

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




More information about the anaconda-patches mailing list