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