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

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