diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-03 15:37:57 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-03 15:37:57 +0000 |
| commit | 4422d2689f60ec0ac2d10db07919f746724cd9b3 (patch) | |
| tree | ff14fdcabd1c8cf6250f7e9b780e57997e1d9c53 | |
| parent | 2e432bba1f38efc5c61882d72f9c83a9ba26ccd9 (diff) | |
| download | python-apt-4422d2689f60ec0ac2d10db07919f746724cd9b3.tar.gz | |
* added MaxRetries to the configuration, retry on update errors as well
| -rw-r--r-- | DistUpgrade/DistUpgrade.cfg | 6 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 33 | ||||
| -rw-r--r-- | DistUpgrade/DistUpgradeViewNonInteractive.py | 3 |
3 files changed, 26 insertions, 16 deletions
diff --git a/DistUpgrade/DistUpgrade.cfg b/DistUpgrade/DistUpgrade.cfg index fdc70150..f4491202 100644 --- a/DistUpgrade/DistUpgrade.cfg +++ b/DistUpgrade/DistUpgrade.cfg @@ -1,6 +1,3 @@ -[General] -Frontend=GtkDistUpgradeView - # Distro contains global information about the upgrade [Distro] # the meta-pkgs we support @@ -32,3 +29,6 @@ From=breezy To=dapper ValidOrigin=Ubuntu ValidMirrors = http://archive.ubuntu.com/ubuntu, http://security.ubuntu.com/ubuntu, http://archive.distrosprint/ubuntu/ + +[Network] +MaxRetries=3
\ No newline at end of file diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 3a43d517..1bcf81d3 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -158,17 +158,25 @@ class DistUpgradeControler(object): progress = self._view.getFetchProgress() # FIXME: retry here too? just like the DoDistUpgrade? # also remove all files from the lists partial dir! - try: - res = self.cache.update(progress) - except IOError, e: - self._view.error(_("Error during update"), - _("A problem occured during the update. " - "This is usually some sort of network " - "problem, please check your network " - "connection and retry."), - "%s" % e) - return False - return True + currentRetry = 0 + maxRetries = self.config.get("Network","MaxRetries") + while currentRetry < maxRetries: + try: + res = self.cache.update(progress) + except IOError, e: + logging.error("IOError in cache.update(): '%s'. Retrying (currentTry: %s)" % (e,currentTry)) + currentRetry += 1 + continue + # no exception, so all was fine, we are done + return True + + self._view.error(_("Error during update"), + _("A problem occured during the update. " + "This is usually some sort of network " + "problem, please check your network " + "connection and retry."), "%s" % e) + return False + def askDistUpgrade(self): if not self.cache.distUpgrade(self._view): @@ -196,7 +204,8 @@ class DistUpgradeControler(object): fprogress = self._view.getFetchProgress() iprogress = self._view.getInstallProgress() # retry the fetching in case of errors - while currentRetry < 3: + maxRetries = self.config.get("Network","MaxRetries") + while currentRetry < maxRetries: try: res = self.cache.commit(fprogress,iprogress) except SystemError, e: diff --git a/DistUpgrade/DistUpgradeViewNonInteractive.py b/DistUpgrade/DistUpgradeViewNonInteractive.py index bb426a7a..6bd110e4 100644 --- a/DistUpgrade/DistUpgradeViewNonInteractive.py +++ b/DistUpgrade/DistUpgradeViewNonInteractive.py @@ -21,6 +21,7 @@ import apt import logging +from DistUpgradeView import DistUpgradeView class NonInteractiveInstallProgress(apt.progress.InstallProgress): def error(self, pkg, errormsg): @@ -28,7 +29,7 @@ class NonInteractiveInstallProgress(apt.progress.InstallProgress): def conffile(self, current, new): logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) -class NonInteractiveDistUpgradeView(object): +class NonInteractiveDistUpgradeView(DistUpgradeView): " non-interactive version of the upgrade view " def __init__(self): pass |
