[pykickstart:master] Move some statically detectable kickstart errors out of anaconda (#1117908)
mulhern
amulhern at redhat.com
Wed Aug 20 20:38:45 UTC 2014
Related: rhbz#1117908
These errors have everything to do with the options in the file and nothing
to do with the situation in which they are supposed to be executed, so they
should be checked when the file is read.
Suggest --noformat option as well, since the effect of --noformat option is
to set preexist to True.
Signed-off-by: mulhern <amulhern at redhat.com>
---
pykickstart/commands/logvol.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index f8d571a..9d96aea 100644
--- a/pykickstart/commands/logvol.py
+++ b/pykickstart/commands/logvol.py
@@ -472,4 +472,12 @@ class F20_LogVol(F18_LogVol):
errorMsg = _("The logvol and autopart commands can't be used at the same time")
raise KickstartParseError(formatErrorMsg(self.lineno, msg=errorMsg))
+ if not retval.preexist and not retval.percent and not retval.size:
+ errorMsg = _("No size given for logical volume \"%s\". Use one of --useexisting, --noformat, --size, or --percent." % self.name)
+ raise KickstartParseError(formatErrorMsg(self.lineno, msg=errorMsg))
+
+ if retval.percent is not None and (retval.percent < 0 or retval.percent > 100):
+ errorMsg = _("Percentage must be between 0 and 100.")
+ raise KickstartValueError(formatErrorMsg(self.lineno, msg=errorMsg))
+
return retval
--
1.9.3
More information about the anaconda-patches
mailing list