client/rhel/yum-rhn-plugin/actions/packages.py | 1
client/rhel/yum-rhn-plugin/rhnplugin.py | 151 ++++++++++++-------------
2 files changed, 73 insertions(+), 79 deletions(-)
New commits:
commit 8094faa255ffde5e2c5261eb6c1ceb208b2990fc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Aug 1 13:49:03 2011 +0200
W:278: Bad indentation.
fixing
W:278: Bad indentation. Found 10 spaces, expected 12
W:279: Bad indentation. Found 12 spaces, expected 16
W:281: Bad indentation. Found 10 spaces, expected 12
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 52ef32e..9ed2edc 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -276,10 +276,10 @@ class RhnRepo(YumRepository):
# support failover urls, #232567
urls = []
if type(channel['url']) == list:
- for url in channel['url']:
- urls.append(url + '/GET-REQ/' + self.id)
+ for url in channel['url']:
+ urls.append(url + '/GET-REQ/' + self.id)
else: # type will be always list since Spacewalk 1.4, in future this will be dead
coed
- urls.append(channel['url'] + '/GET-REQ/' + self.id)
+ urls.append(channel['url'] + '/GET-REQ/' + self.id)
self.baseurl = urls
self.urls = self.baseurl
commit 45d1ab84b373f0d0216bbbb51c5a32078e36bce6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Aug 1 13:45:03 2011 +0200
call conduit.getConf() only once
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index c8d61f8..52ef32e 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -148,12 +148,13 @@ def init_hook(conduit):
return
repos = conduit.getRepos()
- cachedir = conduit.getConf().cachedir
- default_gpgcheck = conduit.getConf().gpgcheck
+ conduit_conf = conduit.getConf()
+ cachedir = conduit_conf.cachedir
+ default_gpgcheck = conduit_conf.gpgcheck
gpgcheck = conduit.confBool('main', 'gpgcheck', default_gpgcheck)
sslcacert = get_ssl_ca_cert(up2date_cfg)
- enablegroups = conduit.getConf().enablegroups
- metadata_expire = conduit.getConf().metadata_expire
+ enablegroups = conduit_conf.enablegroups
+ metadata_expire = conduit_conf.metadata_expire
cachefilename = os.path.join(cachedir, cachedRHNReposFile)
try:
@@ -170,8 +171,8 @@ def init_hook(conduit):
repo.enablegroups = enablegroups
repo.metadata_expire = metadata_expire
repo._proxy_dict = proxy_dict
- if hasattr(conduit.getConf(), '_repos_persistdir'):
- repo.base_persistdir = conduit.getConf()._repos_persistdir
+ if hasattr(conduit_conf, '_repos_persistdir'):
+ repo.base_persistdir = conduit_conf._repos_persistdir
repoOptions = getRHNRepoOptions(conduit, repo.id)
if repoOptions:
for o in repoOptions:
commit 0f503061d78c99ba1704094928107e011468c594
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Aug 1 12:15:52 2011 +0200
691283 - create persistdir in _repos_persistdir instead of PWD
reimplemented a50a4746bfd801e5765dfcff4577261cf63fdd60
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 0480a0d..c8d61f8 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -209,6 +209,8 @@ def addCachedRepos(conduit):
repo.baseurl = urls
repo.urls = repo.baseurl
repo.name = reponame
+ if hasattr(conduit.getConf(), '_repos_persistdir'):
+ repo.base_persistdir = conduit.getConf()._repos_persistdir
repo.enable()
if not repos.findRepos(repo.id):
repos.add(repo)
commit 3d53676183ab2a488ec07b928ccbdca5dd3cbbda
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Aug 1 11:48:53 2011 +0200
fix variable typo
reimplmented 0daa72c1a285e1daab1ecaf08e8b2cac457728c1
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index f8b0740..0480a0d 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -198,7 +198,7 @@ def addCachedRepos(conduit):
repolist = [ line.rstrip().split(' ', 1) for line in cachefile.readlines()]
cachefile.close()
urls = ["http://dummyvalue"]
- for repoitem in repolist:
+ for repo_item in repolist:
if len(repo_item) == 1:
repo_item.append('')
(repoid, reponame) = repo_item
commit 485ddb9090c3550d2c6dfffc9c3d0baecc5cb632
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Aug 1 11:45:11 2011 +0200
add repo name in case you have old format of rhnplugin.repos
reimplemented b12837c8d1e45a6de46bd02fff10ed4fefac5bc7
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 94f4460..f8b0740 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -198,7 +198,10 @@ def addCachedRepos(conduit):
repolist = [ line.rstrip().split(' ', 1) for line in cachefile.readlines()]
cachefile.close()
urls = ["http://dummyvalue"]
- for (repoid, reponame) in repolist:
+ for repoitem in repolist:
+ if len(repo_item) == 1:
+ repo_item.append('')
+ (repoid, reponame) = repo_item
repodir = os.path.join(cachedir, repoid)
if os.path.isdir(repodir):
repo = YumRepository(repoid)
commit 3a47899d842b2db14bafc2d1539ddef45b85f216
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jul 29 17:07:07 2011 +0200
684342 - beside repo.id, cache even repo.name
reimplemented 6da41679b8fe50538f108111fabe5b5cfc46e636
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 870a374..94f4460 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -180,7 +180,7 @@ def init_hook(conduit):
(repo.id, o[0], o[1]))
repos.add(repo)
if cachefile:
- cachefile.write(repo.id + "\n")
+ cachefile.write("%s %s\n" % (repo.id, repo.name))
if cachefile:
cachefile.close()
@@ -195,16 +195,17 @@ def addCachedRepos(conduit):
if not os.access(cachefilename, os.R_OK):
return
cachefile = open(cachefilename, 'r')
- repolist = [ line.rstrip() for line in cachefile.readlines()]
+ repolist = [ line.rstrip().split(' ', 1) for line in cachefile.readlines()]
cachefile.close()
urls = ["http://dummyvalue"]
- for reponame in repolist:
- repodir = os.path.join(cachedir, reponame)
+ for (repoid, reponame) in repolist:
+ repodir = os.path.join(cachedir, repoid)
if os.path.isdir(repodir):
- repo = YumRepository(reponame)
+ repo = YumRepository(repoid)
repo.basecachedir = cachedir
repo.baseurl = urls
repo.urls = repo.baseurl
+ repo.name = reponame
repo.enable()
if not repos.findRepos(repo.id):
repos.add(repo)
commit b41f07124fa6c02a725bf867d149f0132e23c6ba
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jul 29 15:38:02 2011 +0200
disable network in cache only mode
reimplemented 1154ea771d908c8181d974483178ad9ac32074d3
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 5924985..870a374 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -94,6 +94,7 @@ def init_hook(conduit):
filt_parser = FilterOptionParser(add_help_option=False)
filt_parser.add_option('', '--version',
action="store_true")
filt_parser.add_option('', '--help', action="store_true")
+ filt_parser.add_option('-C', '--cacheonly',
action="store_true")
(filt_opts, filt_commands) = filt_parser.parse_args()
if filt_opts.version or filt_opts.help or filt_commands == []:
rhn_enabled = False
@@ -107,6 +108,12 @@ def init_hook(conduit):
if os.path.exists(pcklAuthFileName):
os.unlink(pcklAuthFileName)
return
+ if filt_opts.cacheonly:
+ rhn_enabled = False
+ addCachedRepos(conduit)
+ conduit.info(10, _("Using list of RHN repos from cache") +
+ "\n" + RHN_DISABLED)
+ return
try:
login_info = up2dateAuth.getLoginInfo()
commit 3354df996f8ee4279386686fe9425e191c96904a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jul 29 15:32:18 2011 +0200
cache list of last seen channels so we can correctly clean them
reimplemented 605255c555e375b2a52d4b64cca7716904d228c5
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index eaf10b7..5924985 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -44,6 +44,7 @@ __revision__ = "$Rev$"
requires_api_version = '2.5'
plugin_type = TYPE_CORE
pcklAuthFileName = "/var/spool/up2date/loginAuth.pkl"
+cachedRHNReposFile = 'rhnplugin.repos'
rhn_enabled = True
@@ -100,8 +101,11 @@ def init_hook(conduit):
"\n" + RHN_DISABLED)
return
if filt_commands[0] == 'clean':
- formReposForClean(conduit)
+ addCachedRepos(conduit)
conduit.info(10, _("Cleaning") + "\n" + RHN_DISABLED)
+ # cleanup cached login info
+ if os.path.exists(pcklAuthFileName):
+ os.unlink(pcklAuthFileName)
return
try:
@@ -144,6 +148,11 @@ def init_hook(conduit):
enablegroups = conduit.getConf().enablegroups
metadata_expire = conduit.getConf().metadata_expire
+ cachefilename = os.path.join(cachedir, cachedRHNReposFile)
+ try:
+ cachefile = open(cachefilename, 'w')
+ except:
+ cachefile = None
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
@@ -163,35 +172,35 @@ def init_hook(conduit):
conduit.info(5, "Repo '%s' setting option '%s' =
'%s'" %
(repo.id, o[0], o[1]))
repos.add(repo)
+ if cachefile:
+ cachefile.write(repo.id + "\n")
+ if cachefile:
+ cachefile.close()
-#bz226151,441265
-#Allows a "yum clean all" to succeed without communicating
-#to backend. Creating a set of dummy repos which mimic the dirs stored locally
-#This gives yum the dir info it needs to peform a clean
-#
-def formReposForClean(conduit):
+def addCachedRepos(conduit):
+ """
+ Add list of repos we've seen last time (from cache file)
+ """
repos = conduit.getRepos()
cachedir = conduit.getConf().cachedir
- try:
- dir_list = os.listdir(cachedir)
- except Exception, e:
- raise yum.Errors.RepoError(str(e))
+ cachefilename = os.path.join(cachedir, cachedRHNReposFile)
+ if not os.access(cachefilename, os.R_OK):
+ return
+ cachefile = open(cachefilename, 'r')
+ repolist = [ line.rstrip() for line in cachefile.readlines()]
+ cachefile.close()
urls = ["http://dummyvalue"]
- for dir in dir_list:
- if dir[0] == ".":
- continue
- if os.path.isdir(os.path.join(cachedir,dir)):
- repo = YumRepository(dir)
+ for reponame in repolist:
+ repodir = os.path.join(cachedir, reponame)
+ if os.path.isdir(repodir):
+ repo = YumRepository(reponame)
repo.basecachedir = cachedir
repo.baseurl = urls
repo.urls = repo.baseurl
repo.enable()
if not repos.findRepos(repo.id):
repos.add(repo)
- # cleanup cached login info
- if os.path.exists(pcklAuthFileName):
- os.unlink(pcklAuthFileName)
def posttrans_hook(conduit):
""" Post rpm transaction hook. We update the RHN profile here.
"""
commit 49ef4e4319fa12732d918aced2329e010b280b2f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jul 29 14:56:38 2011 +0200
627525 - disable network communication with certain commands/options
reimplemented code dropped in 19366c54f6494af3364b6df557be0183a14365e5
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 18f1cbf..eaf10b7 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -22,6 +22,8 @@ except ImportError:
pycurl = None
from iniparse import INIConfig
+from optparse import OptionParser
+
import gettext
t = gettext.translation('yum-rhn-plugin', fallback=True)
_ = t.ugettext
@@ -49,6 +51,10 @@ COMMUNICATION_ERROR = _("There was an error communicating with
RHN.")
from M2Crypto.SSL import SSLError
+class FilterOptionParser(OptionParser):
+ def error(self, msg):
+ pass
+
def init_hook(conduit):
"""
Plugin initialization hook. We setup the RHN channels here.
@@ -83,6 +89,21 @@ def init_hook(conduit):
conduit.error(0, PROXY_ERROR + "\n" + RHN_DISABLED)
return
+ # check commands and options which don't need network communication
+ filt_parser = FilterOptionParser(add_help_option=False)
+ filt_parser.add_option('', '--version',
action="store_true")
+ filt_parser.add_option('', '--help', action="store_true")
+ (filt_opts, filt_commands) = filt_parser.parse_args()
+ if filt_opts.version or filt_opts.help or filt_commands == []:
+ rhn_enabled = False
+ conduit.info(10, _("Either --version, --help or no commands entered")
+
+ "\n" + RHN_DISABLED)
+ return
+ if filt_commands[0] == 'clean':
+ formReposForClean(conduit)
+ conduit.info(10, _("Cleaning") + "\n" + RHN_DISABLED)
+ return
+
try:
login_info = up2dateAuth.getLoginInfo()
except up2dateErrors.RhnServerException, e:
commit 2588ef445b877d3ac21bafaa0e8a60aa3f78729a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:33:09 2011 +0200
Revert "627525 - moved communication with satellite server from init_hook to
prereposetup_hook"
This reverts commit aaf678dd476833ea50f68a20e739e8842a74f708.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 3915cdb..18f1cbf 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -49,9 +49,9 @@ COMMUNICATION_ERROR = _("There was an error communicating with
RHN.")
from M2Crypto.SSL import SSLError
-def prereposetup_hook(conduit):
- """
- Plugin initialization hook. We setup the RHN channels here.
+def init_hook(conduit):
+ """
+ Plugin initialization hook. We setup the RHN channels here.
We get a list of RHN channels from the server, then make a repo object for
each one. This list of repos is then added to yum's list of repos via the
commit 081263f602c841c9d92f7b0702982e71a3a134c6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:33:06 2011 +0200
Revert "cache list of rhn channels so we can correctly clean our stuff"
This reverts commit 605255c555e375b2a52d4b64cca7716904d228c5.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 9b09a0d..3915cdb 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -42,7 +42,6 @@ __revision__ = "$Rev$"
requires_api_version = '2.5'
plugin_type = TYPE_CORE
pcklAuthFileName = "/var/spool/up2date/loginAuth.pkl"
-cachedRHNReposFile = 'rhnplugin.repos'
rhn_enabled = True
@@ -50,32 +49,10 @@ COMMUNICATION_ERROR = _("There was an error communicating with
RHN.")
from M2Crypto.SSL import SSLError
-def init_hook(conduit):
+def prereposetup_hook(conduit):
"""
Plugin initialization hook. We setup the RHN channels here.
- Read list of repos we've seen last time (from cache file)
- """
- cachedir = conduit.getConf().cachedir
- repos = conduit.getRepos()
- cachefilename = os.path.join(cachedir, cachedRHNReposFile)
- if os.access(cachefilename, os.R_OK):
- cachefile = open(cachefilename, 'r')
- repolist = [ line.rstrip() for line in cachefile.readlines()]
- cachefile.close()
- for reponame in repolist:
- repodir = os.path.join(cachedir, reponame)
- if os.path.isdir(repodir):
- repo = YumRepository(reponame)
- repo.basecachedir = cachedir
- repo.baseurl = ['file:///' + repodir ]
- repo.urls = repo.baseurl
- repo.enable()
- if not repos.findRepos(repo.id):
- repos.add(repo)
-
-def prereposetup_hook(conduit):
- """
We get a list of RHN channels from the server, then make a repo object for
each one. This list of repos is then added to yum's list of repos via the
conduit.
@@ -146,11 +123,6 @@ def prereposetup_hook(conduit):
enablegroups = conduit.getConf().enablegroups
metadata_expire = conduit.getConf().metadata_expire
- cachefilename = os.path.join(cachedir, cachedRHNReposFile)
- try:
- cachefile = open(cachefilename, 'w')
- except:
- cachefile = None
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
@@ -169,13 +141,36 @@ def prereposetup_hook(conduit):
setattr(repo, o[0], o[1])
conduit.info(5, "Repo '%s' setting option '%s' =
'%s'" %
(repo.id, o[0], o[1]))
- if repos.findRepos(repo.id):
- repos.delete(repo.id)
repos.add(repo)
- if cachefile:
- cachefile.write(repo.id + "\n")
- if cachefile:
- cachefile.close()
+
+
+#bz226151,441265
+#Allows a "yum clean all" to succeed without communicating
+#to backend. Creating a set of dummy repos which mimic the dirs stored locally
+#This gives yum the dir info it needs to peform a clean
+#
+def formReposForClean(conduit):
+ repos = conduit.getRepos()
+ cachedir = conduit.getConf().cachedir
+ try:
+ dir_list = os.listdir(cachedir)
+ except Exception, e:
+ raise yum.Errors.RepoError(str(e))
+ urls = ["http://dummyvalue"]
+ for dir in dir_list:
+ if dir[0] == ".":
+ continue
+ if os.path.isdir(os.path.join(cachedir,dir)):
+ repo = YumRepository(dir)
+ repo.basecachedir = cachedir
+ repo.baseurl = urls
+ repo.urls = repo.baseurl
+ repo.enable()
+ if not repos.findRepos(repo.id):
+ repos.add(repo)
+ # cleanup cached login info
+ if os.path.exists(pcklAuthFileName):
+ os.unlink(pcklAuthFileName)
def posttrans_hook(conduit):
""" Post rpm transaction hook. We update the RHN profile here.
"""
commit cbc61c1f30dc6a2ca876ca4c7f642a6af94bc434
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:33:03 2011 +0200
Revert "switch off network communication in cache only mode"
This reverts commit 1154ea771d908c8181d974483178ad9ac32074d3.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index d87dd72..9b09a0d 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -82,11 +82,6 @@ def prereposetup_hook(conduit):
"""
global rhn_enabled
-
- if '-C' in sys.argv:
- # don't communicate with RHN server but use cached repos
- rhn_enabled = False
- return
RHN_DISABLED = _("RHN Satellite or RHN Classic support will be disabled.")
commit e5b1f92999511078c98578efbd3666e9c3d3fa53
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:29:55 2011 +0200
Revert "repopulate package sack after initial setup"
This reverts commit 103100a26ed7fb6e6aba71a76c07b964bd0f7a06.
diff --git a/client/rhel/yum-rhn-plugin/actions/packages.py
b/client/rhel/yum-rhn-plugin/actions/packages.py
index 07b6a54..fd539cf 100644
--- a/client/rhel/yum-rhn-plugin/actions/packages.py
+++ b/client/rhel/yum-rhn-plugin/actions/packages.py
@@ -64,7 +64,6 @@ class YumAction(yum.YumBase):
self.doRpmDBSetup()
self.doRepoSetup()
self.doSackSetup()
- self.repos.populateSack(mdtype='all')
# Copied from yum/cli.py, more or less
def doTransaction(self):
commit b806e0c3e31ae68fccc68c36be338f548908c868
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:27:14 2011 +0200
Revert "684342 - beside repo.id, cache even repo.name"
This reverts commit 6da41679b8fe50538f108111fabe5b5cfc46e636.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index ab397ec..d87dd72 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -61,16 +61,15 @@ def init_hook(conduit):
cachefilename = os.path.join(cachedir, cachedRHNReposFile)
if os.access(cachefilename, os.R_OK):
cachefile = open(cachefilename, 'r')
- repolist = [ line.rstrip().split(' ', 1) for line in
cachefile.readlines()]
+ repolist = [ line.rstrip() for line in cachefile.readlines()]
cachefile.close()
- for (repoid, reponame) in repolist:
- repodir = os.path.join(cachedir, repoid)
+ for reponame in repolist:
+ repodir = os.path.join(cachedir, reponame)
if os.path.isdir(repodir):
- repo = YumRepository(repoid)
+ repo = YumRepository(reponame)
repo.basecachedir = cachedir
repo.baseurl = ['file:///' + repodir ]
repo.urls = repo.baseurl
- repo.name = reponame
repo.enable()
if not repos.findRepos(repo.id):
repos.add(repo)
@@ -179,7 +178,7 @@ def prereposetup_hook(conduit):
repos.delete(repo.id)
repos.add(repo)
if cachefile:
- cachefile.write("%s %s\n" % (repo.id, repo.name))
+ cachefile.write(repo.id + "\n")
if cachefile:
cachefile.close()
commit 1f87d811f30e7483ea9244ec89cdd1d3604c46f1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:27:04 2011 +0200
Revert "688870 - also check whether cached repo is valid"
This reverts commit 44955186189e3a60afa07e6e4d1b5c9710b2e61c.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 9ace084..ab397ec 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -65,8 +65,7 @@ def init_hook(conduit):
cachefile.close()
for (repoid, reponame) in repolist:
repodir = os.path.join(cachedir, repoid)
- if os.path.isdir(repodir) and os.path.isfile(
- os.path.join(repodir, 'repodata',
'repomd.xml')):
+ if os.path.isdir(repodir):
repo = YumRepository(repoid)
repo.basecachedir = cachedir
repo.baseurl = ['file:///' + repodir ]
commit 380b854b049a0abe47029754f348ac5e168052bd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:27:00 2011 +0200
Revert "add repo name in case you have old format of rhnplugin.repos"
This reverts commit b12837c8d1e45a6de46bd02fff10ed4fefac5bc7.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index c0e04fc..9ace084 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -63,10 +63,7 @@ def init_hook(conduit):
cachefile = open(cachefilename, 'r')
repolist = [ line.rstrip().split(' ', 1) for line in
cachefile.readlines()]
cachefile.close()
- for repoitem in repolist:
- if len(repo_item) == 1:
- repo_item.append('')
- (repoid, reponame) = repo_item
+ for (repoid, reponame) in repolist:
repodir = os.path.join(cachedir, repoid)
if os.path.isdir(repodir) and os.path.isfile(
os.path.join(repodir, 'repodata',
'repomd.xml')):
commit 046d40e8460c3c5e87be6b6f1f1f257a7c9b9a0d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:26:48 2011 +0200
Revert "fix variable typo"
This reverts commit 0daa72c1a285e1daab1ecaf08e8b2cac457728c1.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 6422ebd..c0e04fc 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -63,7 +63,7 @@ def init_hook(conduit):
cachefile = open(cachefilename, 'r')
repolist = [ line.rstrip().split(' ', 1) for line in
cachefile.readlines()]
cachefile.close()
- for repo_item in repolist:
+ for repoitem in repolist:
if len(repo_item) == 1:
repo_item.append('')
(repoid, reponame) = repo_item
commit b21dedf3c288d54cbba727eed1581af2bae1f013
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:26:33 2011 +0200
Revert "690234 - do not re-create repo if it exist and is type of RhnRepo"
This reverts commit 9193b78abe2333e353488e9f38d6ed3eacc7ed7c.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 1c8a873..6422ebd 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -164,14 +164,6 @@ def prereposetup_hook(conduit):
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
- already_exists_repos = repos.findRepos(repo.id)
- if already_exists_repos:
- # there will be nearly always only one, and even if there is more
- # repos, we can ignore them
- if type(already_exists_repos[0]) == type(repo): # repo is type of
RhnRepo
- continue # repo has been already initialized
- else: # YumRepository from _init, made for caching
- repos.delete(repo.id)
repo.basecachedir = cachedir
repo.gpgcheck = gpgcheck
repo.proxy = proxy_url
commit f66aead9ab263e953b8cd72b93b02f40dcdcef8d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:26:28 2011 +0200
Revert "688870 - resolve --enablerepo/--disablerepo for RHN repos"
This reverts commit 1147d9d704d797483e0f30f086125468d91b9f1a.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index aa4acb3..1c8a873 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -195,15 +195,6 @@ def prereposetup_hook(conduit):
if cachefile:
cachefile.close()
- # resolve --enablerepo/--disablerepo for RHN repos
- opts = conduit.getCmdLine()[0]
- for opt, repoexp in opts.repos:
- if opt == '--enablerepo':
- conduit._base.repos.enableRepo(repoexp)
- elif opt == '--disablerepo':
- conduit._base.repos.disableRepo(repoexp)
-
-
def posttrans_hook(conduit):
""" Post rpm transaction hook. We update the RHN profile here.
"""
global rhn_enabled
commit 2f7cc446d3a7ca11acf00bf21a88f1951f8035a6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:26:24 2011 +0200
Revert "there not opts when called from rhn_check"
This reverts commit fc582aee3a0f3e563ae6cfbfc5ead05f2a3b9298.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 546aaa7..aa4acb3 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -197,8 +197,7 @@ def prereposetup_hook(conduit):
# resolve --enablerepo/--disablerepo for RHN repos
opts = conduit.getCmdLine()[0]
- if opts:
- for opt, repoexp in opts.repos:
+ for opt, repoexp in opts.repos:
if opt == '--enablerepo':
conduit._base.repos.enableRepo(repoexp)
elif opt == '--disablerepo':
commit 6a27d62698bf7e07615accfd7f688ee5a524943b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:24:40 2011 +0200
Revert "690190 - yumdownloader set callbacks soon, save it to new repo"
This reverts commit db2e9e9a901b4cd975a19b18ff99ca702360d7d3.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index a3a7e69..546aaa7 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -171,8 +171,6 @@ def prereposetup_hook(conduit):
if type(already_exists_repos[0]) == type(repo): # repo is type of
RhnRepo
continue # repo has been already initialized
else: # YumRepository from _init, made for caching
- callback = already_exists_repos[0].callback
- repo.setCallback(callback)
repos.delete(repo.id)
repo.basecachedir = cachedir
repo.gpgcheck = gpgcheck
commit ec5c355f7a02978ee858ea533d83ceab06eba967
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:24:39 2011 +0200
Revert "remove dead code"
This reverts commit 618a8016f76f10c4bbf10715924bd1fbb138a737.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 99f9834..a3a7e69 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -189,6 +189,8 @@ def prereposetup_hook(conduit):
setattr(repo, o[0], o[1])
conduit.info(5, "Repo '%s' setting option '%s' =
'%s'" %
(repo.id, o[0], o[1]))
+ if repos.findRepos(repo.id):
+ repos.delete(repo.id)
repos.add(repo)
if cachefile:
cachefile.write("%s %s\n" % (repo.id, repo.name))
commit b85aa7f15985b803c15411a259cb3d86ff8679e5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:24:07 2011 +0200
Revert "691283 - create persistdir in _repos_persistdir instead of PWD"
This reverts commit a50a4746bfd801e5765dfcff4577261cf63fdd60.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index d27aa2a..99f9834 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -75,8 +75,6 @@ def init_hook(conduit):
repo.baseurl = ['file:///' + repodir ]
repo.urls = repo.baseurl
repo.name = reponame
- if hasattr(conduit.getConf(), '_repos_persistdir'):
- repo.base_persistdir = conduit.getConf()._repos_persistdir
repo.enable()
if not repos.findRepos(repo.id):
repos.add(repo)
commit 289ece08b09b9b83e5e3371018f4cd35993a2ebd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:24:06 2011 +0200
Revert "W:202: Bad indentation."
This reverts commit 43c91a286bed81fdd92156021aee0c729376e7ab.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index f7c99b6..d27aa2a 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -60,26 +60,26 @@ def init_hook(conduit):
repos = conduit.getRepos()
cachefilename = os.path.join(cachedir, cachedRHNReposFile)
if os.access(cachefilename, os.R_OK):
- cachefile = open(cachefilename, 'r')
- repolist = [ line.rstrip().split(' ', 1) for line in
cachefile.readlines()]
- cachefile.close()
- for repo_item in repolist:
- if len(repo_item) == 1:
- repo_item.append('')
- (repoid, reponame) = repo_item
- repodir = os.path.join(cachedir, repoid)
- if os.path.isdir(repodir) and os.path.isfile(
+ cachefile = open(cachefilename, 'r')
+ repolist = [ line.rstrip().split(' ', 1) for line in
cachefile.readlines()]
+ cachefile.close()
+ for repo_item in repolist:
+ if len(repo_item) == 1:
+ repo_item.append('')
+ (repoid, reponame) = repo_item
+ repodir = os.path.join(cachedir, repoid)
+ if os.path.isdir(repodir) and os.path.isfile(
os.path.join(repodir, 'repodata',
'repomd.xml')):
- repo = YumRepository(repoid)
- repo.basecachedir = cachedir
- repo.baseurl = ['file:///' + repodir ]
- repo.urls = repo.baseurl
- repo.name = reponame
- if hasattr(conduit.getConf(), '_repos_persistdir'):
- repo.base_persistdir = conduit.getConf()._repos_persistdir
- repo.enable()
- if not repos.findRepos(repo.id):
- repos.add(repo)
+ repo = YumRepository(repoid)
+ repo.basecachedir = cachedir
+ repo.baseurl = ['file:///' + repodir ]
+ repo.urls = repo.baseurl
+ repo.name = reponame
+ if hasattr(conduit.getConf(), '_repos_persistdir'):
+ repo.base_persistdir = conduit.getConf()._repos_persistdir
+ repo.enable()
+ if not repos.findRepos(repo.id):
+ repos.add(repo)
def prereposetup_hook(conduit):
"""
@@ -201,10 +201,10 @@ def prereposetup_hook(conduit):
opts = conduit.getCmdLine()[0]
if opts:
for opt, repoexp in opts.repos:
- if opt == '--enablerepo':
- conduit._base.repos.enableRepo(repoexp)
- elif opt == '--disablerepo':
- conduit._base.repos.disableRepo(repoexp)
+ if opt == '--enablerepo':
+ conduit._base.repos.enableRepo(repoexp)
+ elif opt == '--disablerepo':
+ conduit._base.repos.disableRepo(repoexp)
def posttrans_hook(conduit):
@@ -267,10 +267,10 @@ class RhnRepo(YumRepository):
# support failover urls, #232567
urls = []
if type(channel['url']) == list:
- for url in channel['url']:
- urls.append(url + '/GET-REQ/' + self.id)
+ for url in channel['url']:
+ urls.append(url + '/GET-REQ/' + self.id)
else: # type will be always list since Spacewalk 1.4, in future this will be dead
coed
- urls.append(channel['url'] + '/GET-REQ/' + self.id)
+ urls.append(channel['url'] + '/GET-REQ/' + self.id)
self.baseurl = urls
self.urls = self.baseurl
commit 0c8b9d43a96a1cc566f50fc6f4017bf7617b5302
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:23:23 2011 +0200
Revert "707241 - create progressbar even during groupinstall and do not delete
rhnplugin.repos during groupinstall command"
This reverts commit 83fc936f50812b72e40c3cd64b866bd462a5d53f.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 8660cf5..f7c99b6 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -26,9 +26,6 @@ import gettext
t = gettext.translation('yum-rhn-plugin', fallback=True)
_ = t.ugettext
-sys.path.append('/usr/share/yum-cli')
-from output import YumTextMeter, CacheProgressCallback
-
# TODO: Get the up2date stuff that we need in a better place,
# so we don't have to do path magic.
sys.path.append("/usr/share/rhn/")
@@ -154,17 +151,18 @@ def prereposetup_hook(conduit):
return
repos = conduit.getRepos()
- conduit_conf = conduit.getConf()
- cachedir = conduit_conf.cachedir
- default_gpgcheck = conduit_conf.gpgcheck
+ cachedir = conduit.getConf().cachedir
+ default_gpgcheck = conduit.getConf().gpgcheck
gpgcheck = conduit.confBool('main', 'gpgcheck', default_gpgcheck)
sslcacert = get_ssl_ca_cert(up2date_cfg)
- enablegroups = conduit_conf.enablegroups
- metadata_expire = conduit_conf.metadata_expire
+ enablegroups = conduit.getConf().enablegroups
+ metadata_expire = conduit.getConf().metadata_expire
cachefilename = os.path.join(cachedir, cachedRHNReposFile)
- cachefile_content = ''
- create_cache_even_second_time = not (os.path.exists(cachefilename) and
os.path.getsize(cachefilename))
+ try:
+ cachefile = open(cachefilename, 'w')
+ except:
+ cachefile = None
for channel in svrChannels:
if channel['version']:
repo = RhnRepo(channel)
@@ -173,18 +171,11 @@ def prereposetup_hook(conduit):
# there will be nearly always only one, and even if there is more
# repos, we can ignore them
if type(already_exists_repos[0]) == type(repo): # repo is type of
RhnRepo
- # repo has been already initialized
- if create_cache_even_second_time:
- cachefile_content += already_exists_repos.id + "\n"
- continue
+ continue # repo has been already initialized
else: # YumRepository from _init, made for caching
callback = already_exists_repos[0].callback
repo.setCallback(callback)
repos.delete(repo.id)
- else: # no repo created in init - setup progressbar
- if (not (conduit_conf.debuglevel < 2 or not sys.stdout.isatty())):
- progressbar = YumTextMeter(fo=sys.stdout)
- repo.setCallback(progressbar)
repo.basecachedir = cachedir
repo.gpgcheck = gpgcheck
repo.proxy = proxy_url
@@ -201,15 +192,10 @@ def prereposetup_hook(conduit):
conduit.info(5, "Repo '%s' setting option '%s' =
'%s'" %
(repo.id, o[0], o[1]))
repos.add(repo)
- cachefile_content += "%s %s\n" % (repo.id, repo.name)
- if cachefile_content:
- try:
- cachefile = open(cachefilename, 'w')
- except IOError:
- cachefile = None # this is not fatal, we can live without cache
- if cachefile:
- cachefile.write(cachefile_content)
- cachefile.close()
+ if cachefile:
+ cachefile.write("%s %s\n" % (repo.id, repo.name))
+ if cachefile:
+ cachefile.close()
# resolve --enablerepo/--disablerepo for RHN repos
opts = conduit.getCmdLine()[0]
commit e679a6cf4f0c6733524ae95dc077bd95bbd13da9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:23:17 2011 +0200
Revert "Fixing sloppy coding."
This reverts commit 61548de7b576703ffea3a03998eca3a00ada0e6f.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 66e7a0e..8660cf5 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -175,7 +175,7 @@ def prereposetup_hook(conduit):
if type(already_exists_repos[0]) == type(repo): # repo is type of
RhnRepo
# repo has been already initialized
if create_cache_even_second_time:
- cachefile_content += already_exists_repos[0].id +
"\n"
+ cachefile_content += already_exists_repos.id + "\n"
continue
else: # YumRepository from _init, made for caching
callback = already_exists_repos[0].callback
commit 6f6d7fa3dba0252c6cd25a5f3abbb7ba487a6172
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jul 28 16:21:55 2011 +0200
Revert "703169 - Search for cached repomd.xml in a correct path"
This reverts commit 731bde5f9d0506300e7722294258a8d3b0e689ba.
diff --git a/client/rhel/yum-rhn-plugin/rhnplugin.py
b/client/rhel/yum-rhn-plugin/rhnplugin.py
index 9fd658f..66e7a0e 100644
--- a/client/rhel/yum-rhn-plugin/rhnplugin.py
+++ b/client/rhel/yum-rhn-plugin/rhnplugin.py
@@ -72,7 +72,7 @@ def init_hook(conduit):
(repoid, reponame) = repo_item
repodir = os.path.join(cachedir, repoid)
if os.path.isdir(repodir) and os.path.isfile(
- os.path.join(repodir, 'repomd.xml')):
+ os.path.join(repodir, 'repodata',
'repomd.xml')):
repo = YumRepository(repoid)
repo.basecachedir = cachedir
repo.baseurl = ['file:///' + repodir ]