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

[rhel6-branch] Implement a general version of InstallInterfaceBase.methodstrRepoWindow().



Otherwise the text installation crashes when trying to call it.

Resolves: rhbz#687956
---
 gui.py                  |   10 +++++++++-
 installinterfacebase.py |   20 ++++++++++++++++++++
 yuminstall.py           |   11 +++--------
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/gui.py b/gui.py
index cb33663..9eef63f 100755
--- a/gui.py
+++ b/gui.py
@@ -1132,8 +1132,16 @@ class InstallInterface(InstallInterfaceBase):
         dialog.createDialog()
         dialog.run()
 
-    def methodstrRepoWindow(self, methodstr):
+    def methodstrRepoWindow(self, methodstr, exception):
         from task_gui import RepoMethodstrEditor
+
+        self.anaconda.intf.messageWindow(
+            _("Error Setting Up Repository"),
+            _("The following error occurred while setting up the "
+              "installation repository:\n\n%(e)s\n\nPlease provide the "
+              "correct information for installing %(productName)s.")
+            % {'e': exception, 'productName': productName})
+
         dialog = RepoMethodstrEditor(self.anaconda, methodstr)
         dialog.createDialog()
         return dialog.run()
diff --git a/installinterfacebase.py b/installinterfacebase.py
index 024a28d..71cb9cb 100644
--- a/installinterfacebase.py
+++ b/installinterfacebase.py
@@ -19,6 +19,8 @@
 # Author(s): Hans de Goede <hdegoede redhat com>
 
 import gettext
+import sys
+
 _ = lambda x: gettext.ldgettext("anaconda", x)
 P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
 
@@ -35,6 +37,24 @@ class InstallInterfaceBase(object):
                               custom_buttons=[]):
         raise NotImplementedError
 
+    def methodstrRepoWindow(self, methodstr, exception):
+        """ Called when the repo specified by methodstr could not be found.
+
+            Depending on the interface implementation terminates the program or
+            gives user a chance to specify a new repo path it then returns. The
+            default implementation is to terminate.
+        """
+        self.messageWindow(
+            _("Error Setting Up Repository"),
+            _("The following error occurred while setting up the "
+              "installation repository:\n\n%(e)s\n\n"
+              "Installation can not continue.")
+            % {'e': exception},
+            type = "custom",
+            custom_icon="info",
+            custom_buttons=[_("Exit installer")])
+        sys.exit(0)
+
     def unusedRaidMembersWarning(self, unusedRaidMembers):
         """Warn about unused BIOS RAID members"""
         unusedRaidMembers = \
diff --git a/yuminstall.py b/yuminstall.py
index 876cdbc..6fe1e19 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -354,14 +354,9 @@ class AnacondaYum(YumSorter):
             try:
                 self.configBaseURL()
                 break
-            except SystemError, e:
-                self.anaconda.intf.messageWindow(_("Error Setting Up Repository"),
-                    _("The following error occurred while setting up the "
-                      "installation repository:\n\n%(e)s\n\nPlease provide the "
-                      "correct information for installing %(productName)s.")
-                    % {'e': e, 'productName': productName})
-
-                self.anaconda.methodstr = self.anaconda.intf.methodstrRepoWindow(self.anaconda.methodstr or "cdrom:")
+            except SystemError as exception:
+                self.anaconda.methodstr = self.anaconda.intf.methodstrRepoWindow(self.anaconda.methodstr or "cdrom:",
+                                                                                 exception)
 
         self.doConfigSetup(root=self.anaconda.rootPath)
         if not self.anaconda.id.getUpgrade():
-- 
1.7.3.3


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