[yum-cvs] yum/yumRepo.py

Seth Vidal skvidal at linux.duke.edu
Tue Oct 2 16:47:52 UTC 2007


 yum/yumRepo.py |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 4612c949734dc91f789398f305c5acce7147e8b1
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Oct 2 12:47:46 2007 -0400

    closes rhbug #312781 - if we encounter a mirrorlist which ends up having no valid
    urls in it - then make sure we unlink the cached mirrorlist so we don't
    break the user

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 56715e0..85db15b 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -488,6 +488,16 @@ class YumRepository(Repository, config.RepoConf):
         self.baseurl = self._replace_and_check_url(self.baseurl)
         self.mirrorurls = self._replace_and_check_url(mirrorurls)
         self._urls = self.baseurl + self.mirrorurls
+        # if our mirrorlist is just screwed then make sure we unlink a mirrorlist cache
+        if len(self._urls) < 1:
+            if hasattr(self, 'mirrorlist_file') and os.path.exists(self.mirrorlist_file):
+                if not self.cache:
+                    try:
+                        os.unlink(self.mirrorlist_file)
+                    except (IOError, OSError), e:
+                        print 'Could not delete bad mirrorlist file: %s - %s' % (self.mirrorlist_file, e)
+                    else:
+                        print 'removing mirrorlist with no valid mirrors: %s' % self.mirrorlist_file
         # store them all back in baseurl for compat purposes
         self.baseurl = self._urls
         self.check()



More information about the Yum-cvs-commits mailing list