Blame SOURCES/yum-rhn-plugin-2.0.1-8-el7-to-yum-rhn-plugin-2.0.1-9-el7.patch

9630d3
diff --git a/rhnplugin.py b/rhnplugin.py
9630d3
index d238301..804d441 100644
9630d3
--- a/rhnplugin.py
9630d3
+++ b/rhnplugin.py
9630d3
@@ -168,18 +168,13 @@ def init_hook(conduit):
9630d3
     for channel in svrChannels:
9630d3
         if channel['version']:
9630d3
             repo = RhnRepo(channel)
9630d3
+            setRHNRepoDefaults(conduit, repo)
9630d3
             repo.basecachedir = cachedir
9630d3
-            repo.gpgcheck = conduit_conf.gpgcheck
9630d3
             repo.proxy = proxy_url
9630d3
             repo.sslcacert = sslcacert
9630d3
-            repo.enablegroups = conduit_conf.enablegroups
9630d3
-            repo.metadata_expire = conduit_conf.metadata_expire
9630d3
-            repo.exclude = conduit_conf.exclude
9630d3
             repo._proxy_dict = proxy_dict
9630d3
             if repo.timeout < timeout:
9630d3
                 repo.timeout = timeout
9630d3
-            if hasattr(conduit_conf, '_repos_persistdir'):
9630d3
-                repo.base_persistdir = conduit_conf._repos_persistdir
9630d3
             updateRHNRepoOptions(conduit, repo)
9630d3
             repos.add(repo)
9630d3
             if cachefile:
9630d3
@@ -226,12 +221,11 @@ def addCachedRepos(conduit):
9630d3
         repodir = os.path.join(cachedir, repoid)
9630d3
         if os.path.isdir(repodir):
9630d3
             repo = YumRepository(repoid)
9630d3
+            setRHNRepoDefaults(conduit, repo)
9630d3
             repo.basecachedir = cachedir
9630d3
             repo.baseurl = urls
9630d3
             repo.urls = repo.baseurl
9630d3
             repo.name = reponame
9630d3
-            if hasattr(conduit.getConf(), '_repos_persistdir'):
9630d3
-                repo.base_persistdir = conduit.getConf()._repos_persistdir
9630d3
             updateRHNRepoOptions(conduit, repo)
9630d3
             repo.enable()
9630d3
             if not repos.findRepos(repo.id):
9630d3
@@ -748,6 +742,16 @@ def getRHNRepoOptions(conduit, repoid):
9630d3
         pass
9630d3
     return None
9630d3
 
9630d3
+def setRHNRepoDefaults(conduit, repo):
9630d3
+    # newly created repo gets defaults hardwired in yum/config.py
9630d3
+    # update repo defaults according to values parsed from yum.conf
9630d3
+    conf = conduit.getConf()
9630d3
+    for opt, value in repo.iteritems():
9630d3
+        if hasattr(conf, opt):
9630d3
+            setattr(repo, opt, getattr(conf, opt))
9630d3
+    if hasattr(conf, '_repos_persistdir'):
9630d3
+        repo.base_persistdir = conf._repos_persistdir
9630d3
+
9630d3
 def updateRHNRepoOptions(conduit, repo):
9630d3
     pluginOptions = getRHNRepoOptions(conduit, 'main')
9630d3
     repoOptions = getRHNRepoOptions(conduit, repo.id)
9630d3
diff --git a/yum-rhn-plugin.spec b/yum-rhn-plugin.spec
9630d3
index b5531e6..36a1315 100644
9630d3
--- a/yum-rhn-plugin.spec
9630d3
+++ b/yum-rhn-plugin.spec
9630d3
@@ -1,7 +1,7 @@
9630d3
 Summary: Spacewalk support for yum
9630d3
 Name: yum-rhn-plugin
9630d3
 Version: 2.0.1
9630d3
-Release: 8%{?dist}
9630d3
+Release: 9%{?dist}
9630d3
 License: GPLv2
9630d3
 Group: System Environment/Base
9630d3
 Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
9630d3
@@ -70,6 +70,10 @@ fi
9630d3
 %doc LICENSE
9630d3
 
9630d3
 %changelog
9630d3
+* Fri May 12 2017 Tomas Kasparek <tkasparek@redhat.com> 2.0.1-9
9630d3
+- Resolves: #1418104 - honor yum.conf when setting repo defaults
9630d3
+  (michael.mraka@redhat.com)
9630d3
+
9630d3
 * Mon Mar 06 2017 Gennadii Altukhov <galt@redhat.com> 2.0.1-8
9630d3
 - Resolves: #1398406 - update repo options from rhnplugin.conf even in
9630d3
   cacheonly mode (michael.mraka@redhat.com)