[PATCH] Fixup DiskSet._askForLabelPermission()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function seems to have gotten horribly screwed
up lately:

 - We never actually query the user about initialising
   the partition table; so if you've got an unitialized
   partition table, there's no way to install

 - We've create two versions of the message string and
   use neither

 - We test for "ks and (drive in clearDevs) and initAll"
   twice; the second test can never be true, obviously

 - We test for "not intf" twice, again the second can't
   be true

Patch is untested, but it's clearly an improvement :-)

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>
---
 partedUtils.py |   36 +++++++++---------------------------
 1 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/partedUtils.py b/partedUtils.py
index 725ccc5..17a1208 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -1099,41 +1099,23 @@ class DiskSet:
             return False
 
         rc = 0
-        if ks and (drive in clearDevs) and initAll:
+        if (ks and (drive in clearDevs) and initAll) or \
+	    self.isDisciplineFBA(drive):
             rc = 1
-        else:
-            if not intf:
-                self._removeDisk(drive)
-                return False
-            msg = _("The partition table on device %s was unreadable. "
+        elif intf:
+            deviceFile = "/dev/" + drive
+            dev = parted.PedDevice.get(deviceFile)
+
+            msg = _("The partition table on device %s (%s %-0.f MB) was unreadable.\n"
                     "To create new partitions it must be initialized, "
                     "causing the loss of ALL DATA on this drive.\n\n"
                     "This operation will override any previous "
                     "installation choices about which drives to "
                     "ignore.\n\n"
                     "Would you like to initialize this drive, "
-                    "erasing ALL DATA?") % (drive,)
+                    "erasing ALL DATA?") % (drive, dev.model, getDeviceSizeMB (dev),)
 
-            rc = 0
-            if (ks and (drive in clearDevs) and initAll) or \
-                self.isDisciplineFBA(drive):
-                rc = 1
-            else:
-                if not intf:
-                    self._removeDisk(drive)
-                    return False
-
-                deviceFile = "/dev/" + drive
-                dev = parted.PedDevice.get(deviceFile)
-
-                msg = _("The partition table on device %s (%s %-0.f MB) was unreadable.\n"
-                        "To create new partitions it must be initialized, "
-                        "causing the loss of ALL DATA on this drive.\n\n"
-                        "This operation will override any previous "
-                        "installation choices about which drives to "
-                        "ignore.\n\n"
-                        "Would you like to initialize this drive, "
-                        "erasing ALL DATA?") % (drive, dev.model, getDeviceSizeMB (dev),)
+            rc = intf.messageWindow(_("Warning"), msg, type="yesno")
 
         if rc != 0:
             return True
-- 
1.5.4.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux