FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 06-21-2012, 11:49 AM
Martin Gracik
 
Default Retry automatically when package download fails (#732108)

Before displaying the error dialog, and waiting for user
interaction, retry the download for a few times.
This helps during some WAN install errors.

Conflicts:

pyanaconda/constants.py
pyanaconda/yuminstall.py
---
pyanaconda/constants.py | 4 ++++
pyanaconda/yuminstall.py | 35 +++++++++++++++++++++++------------
2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index f8d4628..2e8c8ab 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -95,3 +95,7 @@ DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda

# DMI information paths
DMI_CHASSIS_VENDOR = "/sys/class/dmi/id/chassis_vendor"
+
+# number of retries before displaying an error dialog
+YUM_DOWNLOAD_RETRIES = 3
+YUM_DOWNLOAD_DELAY = 3
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 0ca534b..764ee22 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -181,14 +181,16 @@ class AnacondaCallback:
self.instLog.flush()
self.openfile = None

+ trynumber = 0
while self.openfile is None:
+ trynumber += 1
try:
fn = repo.getPackage(po)

f = open(fn, 'r')
self.openfile = f
except (yum.Errors.NoMoreMirrorsRepoError, IOError):
- self.ayum._handleFailure(po)
+ self.ayum._handleFailure(po, trynumber)
except yum.Errors.RepoError:
continue
self.inProgressPo = po
@@ -899,32 +901,41 @@ class AnacondaYum(yum.YumBase):
self.repos.setCacheDir(self.conf.cachedir)

def downloadHeader(self, po):
+ trynumber = 0
while True:
# retrying version of download header
+ trynumber += 1
try:
yum.YumBase.downloadHeader(self, po)
break
except (yum.Errors.NoMoreMirrorsRepoError, IOError):
- self._handleFailure(po)
+ self._handleFailure(po, trynumber)
except yum.Errors.RepoError:
continue

- def _handleFailure(self, package):
+ def _handleFailure(self, package, trynumber=YUM_DOWNLOAD_RETRIES):
if package.repo.anacondaBaseURLs[0].startswith("cdrom:"):
buttons = [_("Re_boot"), _("_Eject")]
else:
buttons = [_("Re_boot"), _("_Retry")]

pkgFile = to_unicode(os.path.basename(package.remote_path))
- rc = self.anaconda.intf.messageWindow(_("Error"),
- _("The file %s cannot be opened. This is due to a missing "
- "file, a corrupt package or corrupt media. Please "
- "verify your installation source.

"
- "If you exit, your system will be left in an inconsistent "
- "state that will likely require reinstallation.

") %
- (pkgFile,),
- type="custom", custom_icon="error",
- custom_buttons=buttons)
+
+ # only show the retry window after 3 tries
+ if trynumber < YUM_DOWNLOAD_RETRIES:
+ log.warning('package download failure, retrying automatically')
+ time.sleep(YUM_DOWNLOAD_DELAY * trynumber)
+ rc = 1
+ else:
+ rc = self.anaconda.intf.messageWindow(_("Error"),
+ _("The file %s cannot be opened. This is due to a missing "
+ "file, a corrupt package or corrupt media. Please "
+ "verify your installation source.

"
+ "If you exit, your system will be left in an inconsistent "
+ "state that will likely require reinstallation.

") %
+ (pkgFile,),
+ type="custom", custom_icon="error",
+ custom_buttons=buttons)

if rc == 0:
sys.exit(0)
--
1.7.9.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 08:46 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org