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

9630d3
diff --git a/actions/packages.py b/actions/packages.py
9630d3
index d4ee606..caf042c 100644
9630d3
--- a/actions/packages.py
9630d3
+++ b/actions/packages.py
9630d3
@@ -61,6 +61,7 @@ class YumAction(yum.YumBase):
9630d3
         self.doConfigSetup(debuglevel=self.cfg["debug"])
9630d3
         self.cache_only = None
9630d3
 
9630d3
+        self.doLock()
9630d3
         self.doTsSetup()
9630d3
         self.doRpmDBSetup()
9630d3
         self.doRepoSetup()
9630d3
diff --git a/rhnplugin.py b/rhnplugin.py
9630d3
index 8f1cba0..d238301 100644
9630d3
--- a/rhnplugin.py
9630d3
+++ b/rhnplugin.py
9630d3
@@ -163,7 +163,6 @@ def init_hook(conduit):
9630d3
     repos = conduit.getRepos()
9630d3
     cachedir = conduit_conf.cachedir
9630d3
     sslcacert = get_ssl_ca_cert(up2date_cfg)
9630d3
-    pluginOptions = getRHNRepoOptions(conduit, 'main')
9630d3
 
9630d3
     cachefile = openRHNReposCache(conduit)
9630d3
     for channel in svrChannels:
9630d3
@@ -181,16 +180,7 @@ def init_hook(conduit):
9630d3
                 repo.timeout = timeout
9630d3
             if hasattr(conduit_conf, '_repos_persistdir'):
9630d3
                 repo.base_persistdir = conduit_conf._repos_persistdir
9630d3
-            repoOptions = getRHNRepoOptions(conduit, repo.id)
9630d3
-            for options in [pluginOptions, repoOptions]:
9630d3
-                if options:
9630d3
-                    for o in options:
9630d3
-                        if o[0] == 'exclude': # extend current list
9630d3
-                            setattr(repo, o[0], ",".join(repo.exclude) + ',' + o[1])
9630d3
-                        else: # replace option
9630d3
-                            setattr(repo, o[0], o[1])
9630d3
-                        conduit.info(5, "Repo '%s' setting option '%s' = '%s'" %
9630d3
-                            (repo.id, o[0], o[1]))
9630d3
+            updateRHNRepoOptions(conduit, repo)
9630d3
             repos.add(repo)
9630d3
             if cachefile:
9630d3
                 cachefile.write("%s %s\n" % (repo.id, repo.name))
9630d3
@@ -242,6 +232,7 @@ def addCachedRepos(conduit):
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
                 repos.add(repo)
9630d3
@@ -466,7 +457,8 @@ class RhnRepo(YumRepository):
9630d3
                                       http_headers=headers,
9630d3
                                       ssl_ca_cert = self.sslcacert.encode('utf-8'),
9630d3
                                       timeout=self.timeout,
9630d3
-                                      size = size
9630d3
+                                      size = size,
9630d3
+                                      retry_no_cache=self._retry_no_cache
9630d3
                                       )
9630d3
             return result
9630d3
 
9630d3
@@ -490,7 +482,8 @@ class RhnRepo(YumRepository):
9630d3
                                           http_headers=headers,
9630d3
                                           ssl_ca_cert = self.sslcacert.encode('utf-8'),
9630d3
                                           timeout=self.timeout,
9630d3
-                                          size = size
9630d3
+                                          size = size,
9630d3
+                                          retry_no_cache=self._retry_no_cache
9630d3
                                           )
9630d3
                 return result
9630d3
             except URLGrabError, e:
9630d3
@@ -755,6 +748,19 @@ def getRHNRepoOptions(conduit, repoid):
9630d3
         pass
9630d3
     return None
9630d3
 
9630d3
+def updateRHNRepoOptions(conduit, repo):
9630d3
+    pluginOptions = getRHNRepoOptions(conduit, 'main')
9630d3
+    repoOptions = getRHNRepoOptions(conduit, repo.id)
9630d3
+    for options in [pluginOptions, repoOptions]:
9630d3
+        if options:
9630d3
+            for o in options:
9630d3
+                if o[0] == 'exclude': # extend current list
9630d3
+                    setattr(repo, o[0], ",".join(repo.exclude) + ',' + o[1])
9630d3
+                else: # replace option
9630d3
+                    setattr(repo, o[0], o[1])
9630d3
+                conduit.info(5, "Repo '%s' setting option '%s' = '%s'" %
9630d3
+                    (repo.id, o[0], o[1]))
9630d3
+
9630d3
 def config_hook(conduit):
9630d3
     if hasattr(conduit, 'registerPackageName'):
9630d3
         conduit.registerPackageName("yum-rhn-plugin")
9630d3
diff --git a/yum-rhn-plugin.spec b/yum-rhn-plugin.spec
9630d3
index 83c64d8..b5531e6 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: 7%{?dist}
9630d3
+Release: 8%{?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,14 @@ fi
9630d3
 %doc LICENSE
9630d3
 
9630d3
 %changelog
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)
9630d3
+- Resolves: #1391867 - pass retry_no_cache option to urlgrabber
9630d3
+  (michael.mraka@redhat.com)
9630d3
+- Resolves: #1361185 - use yum's lock to prevent concurent yum & rhn_check
9630d3
+  actions (michael.mraka@redhat.com)
9630d3
+
9630d3
 * Mon Feb 20 2017 Tomas Kasparek <tkasparek@redhat.com> 2.0.1-7
9630d3
 - Resolves: #1423007 - request failed: error reading the headers
9630d3
   (CVE-2016-8743) (pstudeni@redhat.com)