[Yum-devel] [PATCH] Add 'preference' and 'private' to mirror kwargs.

Zdeněk Pavlas zpavlas at redhat.com
Wed Aug 29 08:53:19 UTC 2012


---
 yum/metalink.py |    2 +-
 yum/yumRepo.py  |   10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/yum/metalink.py b/yum/metalink.py
index 51895fd..61aa586 100755
--- a/yum/metalink.py
+++ b/yum/metalink.py
@@ -238,7 +238,7 @@ class MetaLinkRepoMD:
                 host = url2host(url)
                 if host in self._host2mc:
                     continue
-                self._host2mc[host] = mirror.max_connections
+                self._host2mc[host] = mirror
             else:
                 continue
 
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index ec68b6a..eaa59c0 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -538,12 +538,16 @@ class YumRepository(Repository, config.RepoConf):
                                     reget='simple',
                                     **ugopts)
         def add_mc(url):
-            host = urlparse.urlsplit(url).netloc
+            host = urlparse.urlsplit(url).netloc.split('@')[-1]
             mc = self.metalink_data._host2mc.get(host)
-            if mc > 0:
+            if mc:
                 url = {
                     'mirror': misc.to_utf8(url),
-                    'kwargs': { 'max_connections': mc },
+                    'kwargs': {
+                        'max_connections': mc.max_connections,
+                        'preference': mc.preference,
+                        'private': mc.private,
+                    },
                 }
             return url
         urls = self.urls
-- 
1.7.4.4



More information about the Yum-devel mailing list