[PATCH 1/4] Do not add a list of PVs or RAID members when writing out --useexisting (#1021274).
Chris Lumens
clumens at redhat.com
Wed Nov 20 19:25:12 UTC 2013
---
pykickstart/commands/raid.py | 11 ++++++++---
pykickstart/commands/volgroup.py | 16 ++++++++++------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/pykickstart/commands/raid.py b/pykickstart/commands/raid.py
index 0c49214..818c9bd 100644
--- a/pykickstart/commands/raid.py
+++ b/pykickstart/commands/raid.py
@@ -69,9 +69,14 @@ class FC3_RaidData(BaseData):
def __str__(self):
retval = BaseData.__str__(self)
- retval += "raid %s%s %s\n" % (self.mountpoint, self._getArgsAsStr(),
- " ".join(self.members))
- return retval
+ retval += "raid %s%s" % (self.mountpoint, self._getArgsAsStr())
+
+ # Do not output the members list if --preexist was passed in.
+ # This would be invalid input according to the parse method.
+ if not self.preexist:
+ retval += " " + " ".join(self.members)
+
+ return retval.strip() + "\n"
class FC4_RaidData(FC3_RaidData):
removedKeywords = FC3_RaidData.removedKeywords
diff --git a/pykickstart/commands/volgroup.py b/pykickstart/commands/volgroup.py
index eb9dbd9..03569ff 100644
--- a/pykickstart/commands/volgroup.py
+++ b/pykickstart/commands/volgroup.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens at redhat.com>
#
-# Copyright 2005, 2006, 2007, 2012 Red Hat, Inc.
+# Copyright 2005, 2006, 2007, 2012, 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
@@ -61,7 +61,11 @@ class FC3_VolGroupData(BaseData):
retval = BaseData.__str__(self)
retval += "volgroup %s" % self.vgname
retval += self._getArgsAsStr()
- retval += " " + " ".join(self.physvols)
+
+ # Do not output the physical volumes list if --preexist was passed in.
+ # This would be invalid input according to the parse method.
+ if not self.preexist:
+ retval += " " + " ".join(self.physvols)
return retval.strip() + "\n"
@@ -161,28 +165,28 @@ class FC16_VolGroup(FC3_VolGroup):
dest="reserved_percent", type="int", nargs=1, default=0)
return op
-
class RHEL6_VolGroup(FC3_VolGroup):
-
def parse(self, args):
# first call the overriden method
retval = FC3_VolGroup.parse(self, args)
+
# the volgroup command can't be used together with the autopart command
# due to the hard to debug behavior their combination introduces
if self.handler.autopart.seen:
errorMsg = _("The volgroup and autopart commands can't be used at the same time")
raise KickstartParseError(formatErrorMsg(self.lineno, msg=errorMsg))
- return retval
+ return retval
class F20_VolGroup(FC16_VolGroup):
-
def parse(self, args):
# first call the overriden method
retval = FC16_VolGroup.parse(self, args)
+
# the volgroup command can't be used together with the autopart command
# due to the hard to debug behavior their combination introduces
if self.handler.autopart.seen:
errorMsg = _("The volgroup and autopart commands can't be used at the same time")
raise KickstartParseError(formatErrorMsg(self.lineno, msg=errorMsg))
+
return retval
--
1.8.3.1
More information about the anaconda-patches
mailing list