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

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 16 07:11:13 UTC 2014


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.

-- 
Vratislav Podzimek

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




More information about the anaconda-patches mailing list