[pykickstart][PATCH] Make --size and --percent mutually exclusive in logvol.
David Lehman
dlehman at redhat.com
Thu Sep 18 21:58:38 UTC 2014
Related: rhbz#1116435
---
pykickstart/commands/logvol.py | 12 ++++++++++++
pykickstart/handlers/f21.py | 2 +-
tests/commands/logvol.py | 6 ++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index f1fc882..042c02c 100644
--- a/pykickstart/commands/logvol.py
+++ b/pykickstart/commands/logvol.py
@@ -481,3 +481,15 @@ class F20_LogVol(F18_LogVol):
raise KickstartValueError(formatErrorMsg(self.lineno, msg=errorMsg))
return retval
+
+class F21_LogVol(F20_LogVol):
+ def parse(self, args):
+ retval = F20_LogVol.parse(self, args)
+
+ if retval.size and retval.percent:
+ err = formatErrorMsg(self.lineno,
+ msg=_("--size and --percent cannot both be "
+ "specified for the same logvol"))
+ raise KickstartParseError(err)
+
+ return retval
diff --git a/pykickstart/handlers/f21.py b/pykickstart/handlers/f21.py
index 3f377da..d39142b 100644
--- a/pykickstart/handlers/f21.py
+++ b/pykickstart/handlers/f21.py
@@ -56,7 +56,7 @@ class F21Handler(BaseHandler):
"lang": commands.lang.F19_Lang,
"liveimg": commands.liveimg.F19_Liveimg,
"logging": commands.logging.FC6_Logging,
- "logvol": commands.logvol.F20_LogVol,
+ "logvol": commands.logvol.F21_LogVol,
"mediacheck": commands.mediacheck.FC4_MediaCheck,
"method": commands.method.F19_Method,
"multipath": commands.multipath.FC6_MultiPath,
diff --git a/tests/commands/logvol.py b/tests/commands/logvol.py
index e6b96aa..c9f1d17 100644
--- a/tests/commands/logvol.py
+++ b/tests/commands/logvol.py
@@ -297,5 +297,11 @@ class F20_TestCase(F18_TestCase):
KickstartValueError,
"Percentage must be between 0 and 100.")
+class F21_TestCase(F20_TestCase):
+ def runTest(self):
+ F20_TestCase.runTest(self)
+
+ self.assert_parse_error("logvol /home --name=home --vgname=vg --size=2 --percent=30")
+
if __name__ == "__main__":
unittest.main()
--
1.9.3
More information about the anaconda-patches
mailing list