From 49a55e465ad119dd83ecf299eef406927d2b5437 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 4 Apr 2007 19:54:11 +0000 Subject: Removing items from a list you're iterating over confuses python (#235279). --- ChangeLog | 5 +++++ autopart.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2fc368d7..fc7640aa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-04 Chris Lumens + + * autopart.py (doAutoPartition): Removing items from a list you're + iterating over confuses python (#235279). + 2007-04-04 Jeremy Katz * liveinst/liveinst.xinit: Work with changes for running from diff --git a/autopart.py b/autopart.py index d87ac378d..5d5cb0137 100644 --- a/autopart.py +++ b/autopart.py @@ -1449,6 +1449,8 @@ def doAutoPartition(anaconda): # requests. These VGs should only be present on installs where we're # using preexisting partitions that already have LVM information. We # need to do the same thing for preexisting RAID requests, as well. + removeReqs = [] + for req in partitions.requests: if isinstance(req, partRequests.VolumeGroupRequestSpec): lst = req.physicalVolumes @@ -1458,13 +1460,21 @@ def doAutoPartition(anaconda): continue if len(filter (lambda id: partitions.getRequestByID(id) != None, lst)) == 0: - partitions.removeRequest (req) + removeReqs.append(req) + + for req in removeReqs: + partitions.removeRequest(req) + + removeReqs = [] # Now that we've removed bad VGs, remove all LVs that would have # resided on those VGs. for req in filter (lambda r: isinstance(r, partRequests.LogicalVolumeRequestSpec), partitions.requests): if partitions.getRequestByID(req.volumeGroup) == None: - partitions.removeRequest (req) + removeReqs.append(req) + + for req in removeReqs: + partitions.removeRequest(req) # sanity checks for the auto partitioning requests; mostly only useful # for kickstart as our installclass defaults SHOULD be sane -- cgit