[PATCH] Allow recovery from some missing repodata conditions.

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

 



If we try to read the repodata during doRepoSetup and find that it's not
there, allow editing the repository right away and attempt to reconfigure.
These changes will be reflected in task selection later on.
---
 gui.py           |    6 ++++++
 iw/task_gui.py   |    6 ++++--
 text.py          |    4 ++++
 ui/addrepo.glade |    2 +-
 yuminstall.py    |   34 ++++++++++++++++++----------------
 5 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/gui.py b/gui.py
index dd2b822..492b4a0 100755
--- a/gui.py
+++ b/gui.py
@@ -1110,6 +1110,12 @@ class InstallInterface:
                 custom_buttons, custom_icon, run=True, parent=parent).getrc()
         return rc
 
+    def editRepoWindow(self, anaconda, repoObj):
+        from task_gui import RepoEditor
+        dialog = RepoEditor(anaconda, repoObj)
+        dialog.createDialog()
+        dialog.run()
+
     def entryWindow(self, title, text, type="ok", entrylength = None):
         d = EntryWindow(title, text, type, entrylength)
         rc = d.run()
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 7779183..753679a 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -46,7 +46,7 @@ def setupRepo(anaconda, repo):
                 "Please ensure that your repository has been "
                 "correctly generated.\n\n%s" %(e,)),
                                 type="ok", custom_icon="error")
-        anaconda.backend.ayum.repos.delete(self.repo.id)
+        anaconda.backend.ayum.repos.delete(repo.id)
         return False
 
     if not repo.groups_added:
@@ -77,6 +77,8 @@ class RepoEditor:
         self.usernameEntry = self.dxml.get_widget("usernameEntry")
         self.passwordEntry = self.dxml.get_widget("passwordEntry")
 
+        self.dialog.set_title(_("Edit Repository"))
+
     def _enableRepo(self, repourl):
         # Only do this for the real base repo, as that's what will get
         # written out to anaconda-ks.cfg as the method.
@@ -137,7 +139,7 @@ class RepoEditor:
 
         lbl = self.dxml.get_widget("descLabel")
         txt = lbl.get_text()
-        lbl.set_text(txt %(productName,))
+        lbl.set_text(txt)
 
         self.dialog.show_all()
 
diff --git a/text.py b/text.py
index 652141e..9279756 100644
--- a/text.py
+++ b/text.py
@@ -440,6 +440,10 @@ class InstallInterface:
         return self.messageWindow(title, text, type, default, custom_icon,
                                   custom_buttons)
 
+    def editRepoWindow(self, anaconda, repoObj):
+        self.messageWindow(_("Error"),
+                           _("Repository editing is not available in text mode."))
+
     def entryWindow(self, title, text, prompt, entrylength = None):
         (res, value) = EntryWindow(self.screen, title, text, [prompt])
         if res == "cancel":
diff --git a/ui/addrepo.glade b/ui/addrepo.glade
index 0317700..e946dca 100644
--- a/ui/addrepo.glade
+++ b/ui/addrepo.glade
@@ -72,7 +72,7 @@
 	  <child>
 	    <widget class="GtkLabel" id="descLabel">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes" context="yes">Please provide the location where your additional software can be installed from.  Note that this must be a valid repository for %s.</property>
+	      <property name="label" translatable="yes" context="yes">Please provide the location where your additional software can be installed from.</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
diff --git a/yuminstall.py b/yuminstall.py
index b656b17..3593310 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -883,10 +883,8 @@ class YumBackend(AnacondaBackend):
                         task(thisrepo = repo.id)
                         waitwin.next_task()
                     waitwin.pop()
-                except yum.Errors.NoMoreMirrorsRepoError, e:
-                    buttons = [_("_Abort"), _("_Retry")]
-                except yum.Errors.RepoError, e:
-                    buttons = [_("_Abort")]
+                except Exception, e:
+                    buttons = [_("_Exit installer"), "gtk-edit", _("_Retry")]
                 else:
                     break # success
 
@@ -901,16 +899,22 @@ class YumBackend(AnacondaBackend):
                                    _("Unable to read package metadata. This may be "
                                      "due to a missing repodata directory.  Please "
                                      "ensure that your install tree has been "
-                                     "correctly generated.  %s" % e),
+                                     "correctly generated.\n\n%s" % e),
                                      type="custom", custom_icon="error",
                                      custom_buttons=buttons)
                 if rc == 0:
+                    # abort
                     sys.exit(0)
+                elif rc == 1:
+                    # edit
+                    anaconda.intf.editRepoWindow(anaconda, repo)
                 elif rc == 2:
+                    # retry, but only if button is present
+                    continue
+                else:
+                    # continue, but only if button is present
                     self.ayum.repos.delete(repo.id)
                     break
-                else:
-                    continue
 
             # if we're in kickstart the repo may have been deleted just above
             try:
@@ -927,10 +931,8 @@ class YumBackend(AnacondaBackend):
         while 1:
             try:
                 self.doGroupSetup()
-            except yum.Errors.NoMoreMirrorsRepoError:
-                buttons = [_("Re_boot"), _("_Retry")]
-            except (yum.Errors.GroupsError, yum.Errors.RepoError):
-                buttons = [_("Re_boot")]
+            except Exception, e:
+                buttons = [_("_Exit installer"), _("_Retry")]
             else:
                 break # success
 
@@ -1161,10 +1163,8 @@ class YumBackend(AnacondaBackend):
             while 1:
                 try:
                     (code, msgs) = self.ayum.buildTransaction()
-                except yum.Errors.NoMoreMirrorsRepoError, e:
-                    buttons = [_("Re_boot"), _("_Retry")]
-                except RepoError, e:
-                    buttons = [_("Re_boot")]
+                except Exception, e:
+                    buttons = [_("_Exit installer"), "gtk-edit", _("_Retry")]
                 else:
                     break
 
@@ -1173,11 +1173,13 @@ class YumBackend(AnacondaBackend):
                                _("Unable to read package metadata. This may be "
                                  "due to a missing repodata directory.  Please "
                                  "ensure that your install tree has been "
-                                 "correctly generated.  %s" % e),
+                                 "correctly generated.\n\n%s" % e),
                                  type="custom", custom_icon="error",
                                  custom_buttons=buttons)
                 if rc == 0:
                     sys.exit(0)
+                elif rc == 1:
+                    anaconda.intf.editRepoWindow(anaconda, repo)
                 else:
                     continue
 
-- 
1.5.3.7

_______________________________________________
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