[yum-commits] yum-config-manager.py

zpavlas at osuosl.org zpavlas at osuosl.org
Fri Sep 27 12:07:25 UTC 2013


 yum-config-manager.py |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 9325f5f3effe223075afc11b46abb78165fa71b9
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Wed Sep 25 18:03:22 2013 +0200

    yum-config-manager: fix --add-repo. BZ 984216
    
    - Don't require enabled repos for --add-repo to work.
    - Turn off reget (it's on by default)

diff --git a/yum-config-manager.py b/yum-config-manager.py
index df90885..08c17db 100755
--- a/yum-config-manager.py
+++ b/yum-config-manager.py
@@ -9,6 +9,8 @@ from utils import YumUtilBase
 import logging
 
 from iniparse import INIConfig
+import yum.config
+import yum.yumRepo
 
 from yum.parser import varReplace
 
@@ -197,13 +199,16 @@ if opts.addrepo:
         if url.endswith('.repo'): # this is a .repo file - fetch it, put it in our reposdir and enable it
             destname = os.path.basename(url)
             destname = myrepodir + '/' + destname
-            # this sucks - but take the first repo we come to that's enabled
-            # and steal it's grabber object - it could be proxy-laden but that's the risk we take
-            # grumbledy grumble
-            grabber = yb.repos.listEnabled()[0].grabfunc            
+
+            # dummy grabfunc, using [main] options
+            repo = yum.yumRepo.YumRepository('dummy')
+            repo.baseurl = ['http://dummy']
+            repo.populate(yum.config.ConfigParser(), None, yb.conf)
+            grabber = repo.grabfunc; del repo
+
             print 'grabbing file %s to %s' % (url, destname)
             try:
-                result  = grabber.urlgrab(url, filename=destname, copy_local=True)
+                result  = grabber.urlgrab(url, filename=destname, copy_local=True, reget=None)
             except (IOError, OSError, yum.Errors.YumBaseError), e:
                 logger.error('Could not fetch/save url %s to file %s: %s'  % (url, destname, e))
                 continue


More information about the Yum-commits mailing list