Blame SOURCES/BZ-1184912-yum-config-manager-fix-add-repo.patch

5b4f08
--- yum-utils-1.1.31/yum-config-manager.py.orig	2016-02-04 13:54:28.339084020 +0100
5b4f08
+++ yum-utils-1.1.31/yum-config-manager.py	2016-02-04 13:55:02.427900621 +0100
5b4f08
@@ -10,6 +10,8 @@
5b4f08
 import fnmatch
5b4f08
 
5b4f08
 from iniparse import INIConfig
5b4f08
+import yum.config
5b4f08
+import yum.yumRepo
5b4f08
 
5b4f08
 from yum.parser import varReplace
5b4f08
 
5b4f08
@@ -209,13 +211,16 @@
5b4f08
         if url.endswith('.repo'): # this is a .repo file - fetch it, put it in our reposdir and enable it
5b4f08
             destname = os.path.basename(url)
5b4f08
             destname = myrepodir + '/' + destname
5b4f08
-            # this sucks - but take the first repo we come to that's enabled
5b4f08
-            # and steal it's grabber object - it could be proxy-laden but that's the risk we take
5b4f08
-            # grumbledy grumble
5b4f08
-            grabber = yb.repos.listEnabled()[0].grabfunc            
5b4f08
+
5b4f08
+            # dummy grabfunc, using [main] options
5b4f08
+            repo = yum.yumRepo.YumRepository('dummy')
5b4f08
+            repo.baseurl = ['http://dummy']
5b4f08
+            repo.populate(yum.config.ConfigParser(), None, yb.conf)
5b4f08
+            grabber = repo.grabfunc; del repo
5b4f08
+
5b4f08
             print 'grabbing file %s to %s' % (url, destname)
5b4f08
             try:
5b4f08
-                result  = grabber.urlgrab(url, filename=destname, copy_local=True)
5b4f08
+                result  = grabber.urlgrab(url, filename=destname, copy_local=True, reget=None)
5b4f08
             except (IOError, OSError, yum.Errors.YumBaseError), e:
5b4f08
                 logger.error('Could not fetch/save url %s to file %s: %s'  % (url, destname, e))
5b4f08
                 continue