summaryrefslogtreecommitdiffstats
path: root/autopart.py
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2001-07-09 17:20:36 +0000
committerMike Fulbright <msf@redhat.com>2001-07-09 17:20:36 +0000
commit1f8bcc23870d53653cd061abd75b57b41bc7ff1c (patch)
tree87aeafa1608c7398c3865a96a4413f1f095d37e0 /autopart.py
parentacee035ce767f2944bb5a6c61e21e9843adaea72 (diff)
downloadanaconda-1f8bcc23870d53653cd061abd75b57b41bc7ff1c.tar.gz
anaconda-1f8bcc23870d53653cd061abd75b57b41bc7ff1c.tar.xz
anaconda-1f8bcc23870d53653cd061abd75b57b41bc7ff1c.zip
weird things happen when you remove from a list you at iterating over - rewrote to avoid this behavior
Diffstat (limited to 'autopart.py')
-rw-r--r--autopart.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/autopart.py b/autopart.py
index 90984f584..a1604912a 100644
--- a/autopart.py
+++ b/autopart.py
@@ -108,9 +108,14 @@ class partlist:
return retval
def reset(self):
+ dellist = []
for part in self.parts:
+ dellist.append(part)
+
+ for part in dellist:
self.parts.remove(part)
del part
+
self.parts = []
@@ -570,10 +575,14 @@ def processPartitioning(diskset, requests, newParts):
# If we created the extended partition on the same device as the logical
# partition, remove it from out list, as it will be cleaned up for us
# when the extended partition gets removed.
+ dellist = []
for part in newParts.parts:
if (part.type & parted.PARTITION_LOGICAL
and extendeds.has_key(part.geom.disk.dev.path)):
- newParts.parts.remove(part)
+ dellist.append(part)
+
+ for part in dellist:
+ newParts.parts.remove(part)
# Finally, remove all of the partitions we added in the last try from
# the disks. We'll start again from there.