[pykickstart][rhel6-branch] Add clearpart --cdl option. (#1182624)
Brian C. Lane
bcl at redhat.com
Sat Jan 17 00:45:50 UTC 2015
On Thu, Jan 15, 2015 at 01:59:03PM -0500, Samantha N. Bueno wrote:
> --- a/pykickstart/commands/clearpart.py
> +++ b/pykickstart/commands/clearpart.py
> @@ -35,6 +35,7 @@ class FC3_ClearPart(KickstartCommand):
> self.drives = kwargs.get("drives", [])
> self.initAll = kwargs.get("initAll", False)
> self.type = kwargs.get("type", None)
> + self.cdl = kwargs.get("cdl", False)
Normally this would go into a new class instead of modifying an existing
one, but I'm not sure what chris wants for rhel6 so you should see what
he says.
>
> def __str__(self):
> retval = KickstartCommand.__str__(self)
> @@ -61,7 +62,12 @@ class FC3_ClearPart(KickstartCommand):
> else:
> drivestr = ""
>
> - retval += "# Partition clearing information\nclearpart %s %s %s\n" % (clearstr, initstr, drivestr)
> + if self.cdl:
> + cdlstr = "--cdl"
> + else:
> + cdlstr = ""
> +
> + retval += "# Partition clearing information\nclearpart %s %s %s\n" % (clearstr, initstr, drivestr, cdlstr)
> return retval
Missing %s like Jan said.
>
> def _getParser(self):
> @@ -80,6 +86,7 @@ class FC3_ClearPart(KickstartCommand):
> const=CLEARPART_TYPE_LINUX)
> op.add_option("--none", dest="type", action="store_const",
> const=CLEARPART_TYPE_NONE)
> + op.add_option("--cdl", dest="cdl", action="store_true", default=False)
> return op
>
> def parse(self, args):
> diff --git a/tests/commands/clearpart.py b/tests/commands/clearpart.py
> index f4e6076..8c76c85 100644
> --- a/tests/commands/clearpart.py
> +++ b/tests/commands/clearpart.py
> @@ -24,13 +24,15 @@ class FC3_TestCase(CommandTest):
> self.assert_parse("clearpart --all --drives=sda", "clearpart --all --drives=sda\n")
> self.assert_parse("clearpart --all --drives=sda,sdb", "clearpart --all --drives=sda,sdb\n")
> # Big Everything Test
> - self.assert_parse("clearpart --drives=sda,sdb --all --linux --initlabel", "clearpart --linux --initlabel --drives=sda,sdb\n")
> + self.assert_parse("clearpart --drives=sda,sdb --cdl --all --linux --initlabel", "clearpart --linux --initlabel --cdl --drives=sda,sdb\n")
I'd like to see another test or two without all the extras. Throw in
some dasd references for example :)
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list