summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeControler.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-02-03 15:37:57 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2006-02-03 15:37:57 +0000
commit4422d2689f60ec0ac2d10db07919f746724cd9b3 (patch)
treeff14fdcabd1c8cf6250f7e9b780e57997e1d9c53 /DistUpgrade/DistUpgradeControler.py
parent2e432bba1f38efc5c61882d72f9c83a9ba26ccd9 (diff)
downloadpython-apt-4422d2689f60ec0ac2d10db07919f746724cd9b3.tar.gz
* added MaxRetries to the configuration, retry on update errors as well
Diffstat (limited to 'DistUpgrade/DistUpgradeControler.py')
-rw-r--r--DistUpgrade/DistUpgradeControler.py33
1 files changed, 21 insertions, 12 deletions
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: