Re: [PATCH 2/2] Ask about disk initialization only in storageinit step.

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

 



Chris Lumens wrote:
diff --git a/gui.py b/gui.py
index 4e65362..17a7c4f 100755
--- a/gui.py
+++ b/gui.py
@@ -986,6 +986,7 @@ class InstallInterface:
         root = gtk.gdk.get_default_root_window()
         cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR)
         root.set_cursor(cursor)
+        self.initLabelAnswers = {}
def __del__ (self):
         pass

You'll need to add this (and resetInitializeDiskQuestion, and
questionInitializeDisk) to text.py and cmdline.py as well.  The versions
in cmdline.py really just need to print an error message and halt, same
as all the other interactive dialogs in that file.

Right, I will do it, thanks for hints.

@@ -1122,6 +1123,36 @@ class InstallInterface:
         d.destroy()
         return rc
+ def resetInitializeDiskQuestion(self):
+        self.initLabelAnswers = {}
+
+    def questionInitializeDisk(self, path="", description="", size=0,
+                               details=""):
+        retVal = False # The less destructive default
+        if path:
+            # we are caching answers so that we don't
+            # ask in each storage.reset() again
+            if path in self.initLabelAnswers:
+                return self.initLabelAnswers[path]
+
+            rc = self.messageWindow(_("Warning"),
+                    _("Error processing drive:\n\n"
+                      "%(path)s\n%(size)-0.fMB\n%(description)s\n\n"
+                      "This device may need to be reinitialized.\n\n"
+                      "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!%(details)s")
+                    % {'path': path, 'size': size,
+                       'description': description, 'details': details},
+                    type="custom",
+                    custom_buttons = [ _("_Ignore drive"),
+                                       _("_Re-initialize drive") ],
+                    custom_icon="question")
+            if rc == 0:
+                pass
+            else:
+                retVal = True
+            self.initLabelAnswers[path] = retVal
+        return retVal
+
     def beep(self):
         gtk.gdk.beep()

I find things like this easier if you test the negative and return.  So,

    if not path:
        return retVal

    # we are caching answers ...
    ....

I'd write it so too, I will modify it.

Come to think of it, can path, description, size, and details ever be
empty when this method is called?  The error dialog sure doesn't make
much sense without size and description.  Perhaps those should be
required arguments.


Ack.

diff --git a/storage/devicetree.py b/storage/devicetree.py
index b528ab2..ea93c74 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -123,41 +123,6 @@ def getLUKSPassphrase(intf, device, globalPassphrase):
def questionReinitILVM(intf=None, pv_names=None, lv_name=None, vg_name=None):
     retVal = False # The less destructive default

Why didn't you move questionReinitILVM at the same time?


I was thinking about it, I'll look at it and come up with a patch
Delicate field are these inconsistent lvm problems, I need
to learn and test how it works first.

Radek


_______________________________________________
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