summaryrefslogtreecommitdiffstats
path: root/iw
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-08-14 18:39:06 +0000
committerJeremy Katz <katzj@redhat.com>2001-08-14 18:39:06 +0000
commit4c0f6efe69c15d4e25534edd6f899491e2479272 (patch)
tree51cde13799da28fa8d1ef82534e960d5668e077b /iw
parent8ecd37eee2c4be84fd6c94b933a14077f5423b09 (diff)
downloadanaconda-4c0f6efe69c15d4e25534edd6f899491e2479272.tar.gz
anaconda-4c0f6efe69c15d4e25534edd6f899491e2479272.tar.xz
anaconda-4c0f6efe69c15d4e25534edd6f899491e2479272.zip
restoring the backup copy doesn't work...
if processPartitioning fails, we need to remove the request we just added from the request list and, if this isn't a "new new" request, add the old one back in. this also brings in clearer semantics for a request being new as opposed to relying on checking the combination of origrequest.device and origrequest.type fixes 51730 and should also fix a few other places where we get devices of None (eg 51667, 50905, 50858, and possibly others)
Diffstat (limited to 'iw')
-rw-r--r--iw/partition_gui.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 48436bf28..8589903d3 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -755,10 +755,11 @@ class PartitionWindow(InstallWindow):
# create new request of size 1M
request = PartitionSpec(fileSystemTypeGetDefault(), REQUEST_NEW, 1)
- self.editPartitionRequest(request)
+ self.editPartitionRequest(request, isNew = 1)
# edit a partition request
- def editPartitionRequest(self, origrequest):
+ # isNew implies that this request has never been successfully used before
+ def editPartitionRequest(self, origrequest, isNew = 0):
def formatOptionCB(widget, data):
(menuwidget, menu, mntptcombo, ofstype) = data
@@ -1217,15 +1218,19 @@ class PartitionWindow(InstallWindow):
if not queryNoFormatPreExisting(self.intf):
continue
- # backup current (known working) configuration
- backpart = self.partitions.copy()
- if origrequest.device or origrequest.type != REQUEST_NEW:
+ if not isNew:
self.partitions.removeRequest(origrequest)
self.partitions.addRequest(request)
if self.refresh():
- self.partitions = backpart
- self.refresh()
+ # the add failed; remove what we just added and put
+ # back what was there if we removed it
+ self.partitions.removeRequest(request)
+ if not isNew:
+ self.partitions.addRequest(origrequest)
+ if self.refresh():
+ # this worked before and doesn't now...
+ raise RuntimeError, "Returning partitions to state prior to edit failed"
else:
break
@@ -1308,7 +1313,8 @@ class PartitionWindow(InstallWindow):
else:
self.editPartitionRequest(request)
- def editRaidRequest(self, raidrequest):
+ # isNew implies that this request has never been successfully used before
+ def editRaidRequest(self, raidrequest, isNew = 0):
#
# start of editRaidRuquest
#
@@ -1471,20 +1477,19 @@ class PartitionWindow(InstallWindow):
"%s" % (err))
continue
- # backup current (known working) configuration
- backpart = self.partitions.copy()
-
- # XXX should only remove if we know we put it in before
- try:
+ if not isNew:
self.partitions.removeRequest(raidrequest)
- except:
- pass
self.partitions.addRequest(request)
if self.refresh():
- self.partitions = backpart
- self.refresh()
+ # how can this fail? well, if it does, do the remove new,
+ # add old back in dance
+ self.partitions.removeRequest(request)
+ if not isNew:
+ self.partitions.addRequest(raidrequest)
+ if self.refresh():
+ raise RuntimeError, "Returning partitions to state prior to RAID edit failed"
else:
break
@@ -1492,7 +1497,7 @@ class PartitionWindow(InstallWindow):
def makeraidCB(self, widget):
request = PartitionSpec(fileSystemTypeGetDefault(), REQUEST_RAID, 1)
- self.editRaidRequest(request)
+ self.editRaidRequest(request, isNew = 1)
def getScreen (self, fsset, diskset, partitions, intf):
self.fsset = fsset