[yum-commits] 2 commits - plugins/fastestmirror
Luke Macken
lmacken at osuosl.org
Tue Oct 14 14:04:47 UTC 2008
plugins/fastestmirror/fastestmirror.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
New commits:
commit 72cb1cb15b1f834cb7c2c9f13c296cda9b1ad3b8
Author: Luke Macken <lmacken at redhat.com>
Date: Tue Oct 14 10:04:18 2008 -0400
[fastestmirror] Return the correct value from _len_non_ftp
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
index bb51cf4..29eb6b3 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -130,7 +130,7 @@ def _len_non_ftp(urls):
if url.startswith("ftp:"):
continue
num += 1
- return 0
+ return num
def postreposetup_hook(conduit):
"""
commit 35bcc4c8b4422da90e618925ff5e25054dd25de7
Author: Luke Macken <lmacken at redhat.com>
Date: Tue Oct 14 10:03:27 2008 -0400
Fix fastestmirror's exclusion code.
This fixes the exclusion code to to avoid changing the array that is being
iterated. Thanks to Johnny Casey for pointing this out to me and offering
up a potential solution.
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
index 1bcc691..bb51cf4 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -192,11 +192,13 @@ def postreposetup_hook(conduit):
if str(repo) not in repomirrors:
repomirrors[str(repo)] = FastestMirror(repo.urls).get_mirrorlist()
if exclude:
- for mirror in repomirrors[str(repo)]:
+ def excludeCheck(mirror):
if filter(lambda exp: exp in host(mirror),
exclude.replace(',', ' ').split()):
conduit.info(2, "Excluding mirror: %s" % host(mirror))
- repomirrors[str(repo)].remove(mirror)
+ return False
+ return True
+ repomirrors[str(repo)] = filter(excludeCheck,repomirrors[str(repo)])
repo.urls = repomirrors[str(repo)]
if len(repo.urls):
conduit.info(2, " * %s: %s" % (str(repo), host(repo.urls[0])))
@@ -210,6 +212,7 @@ def postreposetup_hook(conduit):
if not loadcache:
write_timedhosts()
+
def read_timedhosts():
"""
This function reads the time and hostname from the plugin's cache file and
More information about the Yum-commits
mailing list