[PATCH 3/5] Move the question about formatting DASD's to the interface class

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

 



This way we can override it in rescue.py, as we never want to format
DASD's in rescue mode.

Related: rhbz#582638
---
 installinterfacebase.py |   27 +++++++++++++++++++++++++++
 storage/dasd.py         |   21 +--------------------
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/installinterfacebase.py b/installinterfacebase.py
index e62400b..626076f 100644
--- a/installinterfacebase.py
+++ b/installinterfacebase.py
@@ -30,6 +30,11 @@ class InstallInterfaceBase(object):
              custom_buttons=None,  custom_icon=None):
         raise NotImplementedError
 
+    def detailedMessageWindow(self, title, text, longText=None, type="ok",
+                              default=None, custom_icon=None,
+                              custom_buttons=[]):
+        raise NotImplementedError
+
     def unusedRaidMembersWarning(self, unusedRaidMembers):
         """Warn about unused BIOS RAID members"""
         unusedRaidMembers = \
@@ -47,3 +52,25 @@ class InstallInterfaceBase(object):
                    (", ".join(unusedRaidMembers),
                     ", ".join(unusedRaidMembers)),
                 custom_icon="warning")
+
+    def questionInitializeDASD(self, c, devs):
+        """Ask if unformatted DASD's should be formatted"""
+        title = P_("Unformatted DASD Device Found",
+                   "Unformatted DASD Devices Found", c)
+        msg = P_("Format uninitialized DASD device?\n\n"
+                 "There is %d uninitialized DASD device on this "
+                 "system.  To continue installation, the device must "
+                 "be formatted.  Formatting will remove any data on "
+                 "this device." % c,
+                 "Format uninitialized DASD devices?\n\n"
+                 "There are %d uninitialized DASD devices on this "
+                 "system.  To continue installation, the devices must "
+                 "be formatted.  Formatting will remove any data on "
+                 "these devices." % c,
+                 c)
+        icon = "/usr/share/icons/gnome/32x32/status/dialog-error.png"
+        buttons = [_("_Format"), _("_Exit installer")]
+        return self.detailedMessageWindow(title, msg, devs.strip(),
+                                             type="custom",
+                                             custom_icon=icon,
+                                             custom_buttons=buttons)
diff --git a/storage/dasd.py b/storage/dasd.py
index 6af6f78..304099d 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -120,30 +120,11 @@ class DASD:
         c = len(self._dasdlist)
 
         if intf and askUser:
-            title = P_("Unformatted DASD Device Found",
-                       "Unformatted DASD Devices Found", c)
-            msg = P_("Format uninitialized DASD device?\n\n"
-                     "There is %d uninitialized DASD device on this "
-                     "system.  To continue installation, the device must "
-                     "be formatted.  Formatting will remove any data on "
-                     "this device." % c,
-                     "Format uninitialized DASD devices?\n\n"
-                     "There are %d uninitialized DASD devices on this "
-                     "system.  To continue installation, the devices must "
-                     "be formatted.  Formatting will remove any data on "
-                     "these devices." % c,
-                     c)
-
             devs = ''
             for dasd in self._dasdlist:
                 devs += "%s\n" % (dasd,)
 
-            icon = "/usr/share/icons/gnome/32x32/status/dialog-error.png"
-            buttons = [_("_Format"), _("_Exit installer")]
-            rc = intf.detailedMessageWindow(title, msg, devs.strip(),
-                                                 type="custom",
-                                                 custom_icon=icon,
-                                                 custom_buttons=buttons)
+            rc = intf.questionInitializeDASD(c, devs)
             if rc == 1:
                 log.info("    not running dasdfmt, exiting installer")
                 sys.exit(0)
-- 
1.7.0.1

_______________________________________________
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