summaryrefslogtreecommitdiffstats
path: root/iw
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-07-10 13:17:16 -0400
committerChris Lumens <clumens@redhat.com>2008-07-10 13:18:10 -0400
commit5a2e42ecb10e1ee984480b28a4c1caf612550239 (patch)
tree0355ca8466076e03d671a87d76101497c2cd3100 /iw
parentfed0395b042662788cc9bf41986887a58e03e838 (diff)
downloadanaconda-5a2e42ecb10e1ee984480b28a4c1caf612550239.tar.gz
anaconda-5a2e42ecb10e1ee984480b28a4c1caf612550239.tar.xz
anaconda-5a2e42ecb10e1ee984480b28a4c1caf612550239.zip
Add better error handling when initializing yum (#453695).
This adds a dialog for when mounting or accessing the provided URL fails right when creating the AnacondaYum object. The user can either provide a new method string, or hit cancel in which case they get the default yum.repos.d repository.
Diffstat (limited to 'iw')
-rw-r--r--iw/task_gui.py83
1 files changed, 69 insertions, 14 deletions
diff --git a/iw/task_gui.py b/iw/task_gui.py
index 548e21d46..84b11c698 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -254,6 +254,9 @@ class RepoEditor:
return True
def run(self, createNewRepoObj=False):
+ applyFuncs = [ self._applyURL, self._applyMedia, self._applyNfs,
+ self._applyHd ]
+
while True:
rc = self.dialog.run()
if rc == gtk.RESPONSE_CANCEL:
@@ -272,19 +275,8 @@ class RepoEditor:
self.repo.repoid = reponame.replace(" ", "")
type = self.typeComboBox.get_active()
-
- if type == 0:
- if not self._applyURL(self.repo):
- continue
- elif type == 1:
- if not self._applyMedia(self.repo):
- continue
- elif type == 2:
- if not self._applyNfs(self.repo):
- continue
- else:
- if not self._applyHd(self.repo):
- continue
+ if not applyFuncs[type](self.repo):
+ continue
repourl = self.baseurlEntry.get_text()
repourl.strip()
@@ -305,6 +297,70 @@ class RepoEditor:
self.dialog.hide()
return rc
+class RepoMethodstrEditor(RepoEditor):
+ def __init__(self, anaconda):
+ RepoEditor.__init__(self, anaconda, None)
+
+ def createDialog(self):
+ RepoEditor.createDialog(self)
+
+ # Hide a bunch of stuff that doesn't apply when we're just prompting
+ # for enough information to form a methodstr.
+ self.dxml.get_widget("nameLabel").hide()
+ self.nameEntry.hide()
+ self.mirrorlistCheckbox.hide()
+ self.proxyCheckbox.hide()
+ self.proxyTable.hide()
+
+ def _applyURL(self):
+ repourl = self.baseurlEntry.get_text()
+ repourl.strip()
+ if not self._validURL(repourl):
+ self.intf.messageWindow(_("Invalid Repository URL"),
+ _("You must provide an HTTP, HTTPS, "
+ "or FTP URL to a repository."))
+ return False
+
+ return repourl
+
+ def _applyMedia(self):
+ cdr = scanForMedia(self.anaconda.backend.ayum.tree)
+ if not cdr:
+ self.intf.messageWindow(_("No Media Found"),
+ _("No installation media was found. "
+ "Please insert a disc into your drive "
+ "and try again."))
+ return False
+
+ return "cdrom://%s:%s" % (cdr, self.anaconda.backend.ayum.tree)
+
+ def _applyNfs(self):
+ return None
+
+ def _applyHd(self):
+ return None
+
+ def run(self):
+ applyFuncs = [ self._applyURL, self._applyMedia, self._applyNfs,
+ self._applyHd ]
+
+ while True:
+ rc = self.dialog.run()
+ if rc == gtk.RESPONSE_CANCEL:
+ rc = None
+ break
+
+ type = self.typeComboBox.get_active()
+ retval = applyFuncs[type]()
+ if not retval:
+ continue
+
+ rc = retval
+ break
+
+ self.dialog.hide()
+ return rc
+
class RepoCreator(RepoEditor):
def __init__(self, anaconda):
RepoEditor.__init__(self, anaconda, None)
@@ -312,7 +368,6 @@ class RepoCreator(RepoEditor):
def createDialog(self):
RepoEditor.createDialog(self)
self.dialog.set_title(_("Add Repository"))
-
def _enableRepo(self, repourl):
try:
self.backend.ayum.repos.add(self.repo)