client/rhel/yum-rhn-plugin/rhnplugin.py | 26 ++++++++++++++++++-------
client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec | 5 +++-
rel-eng/packages/yum-rhn-plugin | 2 -
3 files changed, 24 insertions(+), 9 deletions(-)
New commits:
commit fc82ac4ffd55976bc16a59342606226169aa4322
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Sep 13 13:57:48 2011 +0200
Automatic commit of package [yum-rhn-plugin] release [1.6.11-1].
diff --git a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
index 0ee7fd1..f9ec8c2 100644
--- a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
+++ b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
@@ -1,6 +1,6 @@
Summary: RHN support for yum
Name: yum-rhn-plugin
-Version: 1.6.10
+Version: 1.6.11
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Base
@@ -72,6 +72,9 @@ fi
%doc LICENSE
%changelog
+* Tue Sep 13 2011 Michael Mraka <michael.mraka(a)redhat.com> 1.6.11-1
+- 735339 - truncate rhnplugin.repos when there are no rhn channels
+
* Mon Sep 05 2011 Michael Mraka <michael.mraka(a)redhat.com> 1.6.10-1
- 734492, 734965, 735282 - check command line options only for yum
diff --git a/rel-eng/packages/yum-rhn-plugin b/rel-eng/packages/yum-rhn-plugin
index cb97398..868ceb1 100644
--- a/rel-eng/packages/yum-rhn-plugin
+++ b/rel-eng/packages/yum-rhn-plugin
@@ -1 +1 @@
-1.6.10-1 client/rhel/yum-rhn-plugin/
+1.6.11-1 client/rhel/yum-rhn-plugin/
commit 570e37f07945c0208ec6a5c69a39be7ea34d74f1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Sep 13 13:45:48 2011 +0200
735339 - truncate rhnplugin.repos when there are no rhn channels
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index b38849c..fe88500 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -124,6 +124,7 @@ def init_hook(conduit):
conduit.error(0, _("This system is not registered with RHN.") +
"\n" +
RHN_DISABLED)
rhn_enabled = False
+ truncateRHNReposCache(conduit)
return
CHANNELS_DISABLED = _("RHN channel support will be disabled.")
@@ -132,6 +133,7 @@ def init_hook(conduit):
except up2dateErrors.NoChannelsError:
conduit.error(0, _("This system is not subscribed to any channels.") +
"\n" + CHANNELS_DISABLED)
+ truncateRHNReposCache(conduit)
return
except up2dateErrors.NoSystemIdError:
conduit.error(0, _("This system may not be a registered to RHN. SystemId
could not be acquired.\n") +
@@ -149,13 +151,7 @@ def init_hook(conduit):
sslcacert = get_ssl_ca_cert(up2date_cfg)
pluginOptions = getRHNRepoOptions(conduit, 'main')
- cachefilename = os.path.join(cachedir, cachedRHNReposFile)
- try:
- if not os.path.exists(cachedir):
- os.makedirs(cachedir, 0755)
- cachefile = open(cachefilename, 'w')
- except:
- cachefile = None
+ cachefile = openRHNReposCache(conduit)
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
@@ -185,6 +181,22 @@ def init_hook(conduit):
if cachefile:
cachefile.close()
+def openRHNReposCache(conduit):
+ cachedir = conduit.getConf().cachedir
+ cachefilename = os.path.join(cachedir, cachedRHNReposFile)
+ try:
+ if not os.path.exists(cachedir):
+ os.makedirs(cachedir, 0755)
+ cachefile = open(cachefilename, 'w')
+ except:
+ cachefile = None
+ return cachefile
+
+def truncateRHNReposCache(conduit):
+ cachefile = openRHNReposCache(conduit)
+ if cachefile:
+ cachefile.truncate()
+ cachefile.close()
def addCachedRepos(conduit):
"""
Show replies by date