[pykickstart][rhel6-branch] Add clearpart --cdl option. (#1182624)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Thu Jan 15 18:59:03 UTC 2015
Specifying this option in a ks file will ensure that any LDL DASDs
will be (re)formatted to CDL format.
Resolves: rhbz#1182624
---
docs/kickstart-docs.txt | 3 +++
pykickstart/commands/clearpart.py | 9 ++++++++-
tests/commands/clearpart.py | 4 +++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/kickstart-docs.txt b/docs/kickstart-docs.txt
index 3e9b4d5..409c819 100644
--- a/docs/kickstart-docs.txt
+++ b/docs/kickstart-docs.txt
@@ -372,6 +372,9 @@ clearpart (optional)
* --none (default) - Do not remove any partitions.
+ * --cdl - Automatically format any LDL DASDs to CDL. This option
+ is only really applicable for s390x.
+
cmdline (optional)
Perform the installation in a completely non-interactive command
line mode. Any prompts for interaction halts the install. This mode
diff --git a/pykickstart/commands/clearpart.py b/pykickstart/commands/clearpart.py
index 88307a3..32bd84d 100644
--- 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)
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
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")
# fail
# initlabel should not take a value
self.assert_parse_error("clearpart --initlabel=foo")
# drives must take a value
self.assert_parse_error("clearpart --all --drives")
+ # cdl should not take a value
+ self.assert_parse_error("clearpart --cdl=foo")
# nonsensical parameter test
self.assert_parse_error("clearpart --cheese")
--
1.8.3.1
More information about the anaconda-patches
mailing list