RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1018929 - yum-rhn-plugin syntax issue
Summary: yum-rhn-plugin syntax issue
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum-rhn-plugin
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Matej Kollar
QA Contact: Pavel Studeník
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-14 17:44 UTC by Toshio Ernie Kuratomi
Modified: 2015-07-22 07:25 UTC (History)
5 users (show)

Fixed In Version: yum-rhn-plugin-0.9.1-54-el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 07:25:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch to fix rhnplugin for yum (1.08 KB, patch)
2013-10-14 17:44 UTC, Toshio Ernie Kuratomi
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1390 0 normal SHIPPED_LIVE yum-rhn-plugin bug fix and enhancement update 2015-07-20 17:58:08 UTC

Description Toshio Ernie Kuratomi 2013-10-14 17:44:08 UTC
Created attachment 812133 [details]
Patch to fix rhnplugin for yum

Description of problem:

The latest version of rhn-client-tools, 1.0.0.1-8.el6 changed some API.  The API changes break the yum-rhn-plugin.  I'll attach a patch that fixes the API change and also fixes one error that I encountered after that.

Version-Release number of selected component (if applicable):
yum-rhn-plugin-0.9.1-49.el6.noarch

Comment 2 Michael Mráka 2013-10-16 08:06:35 UTC
Hi Toshio,

Could you please post some steps to reproduce the error?
Also what package version do you have installed?
rpm -q rhn-check rhn-client-tools rhn-setup rhn-setup-gnome yum-rhn-plugin rhnlib

It seems to work fine on my test system.

Regards,
Michael

Comment 3 Toshio Ernie Kuratomi 2013-10-17 00:35:55 UTC
Apologies, after further looking into this, the timeout parameter problem is due to an older version of the up2dateAuth.py file from rhn-client-tools that a prior admin had checked into our sytems as a hotfix.  So the timeout problem is bogus.

For the except e: => except Exception, e: change that does address a valid bug in the code.  It only triggers if an exception is actually raised in the try: block, though:

$ python2
>>> try:
...  pass
... except e:
... pass
>>>
>>> try:
...  raise ValueError
... except e:
...  pass
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
NameError: name 'e' is not defined

The token after except needs to be the name of an exception, not a variable to store the exception in.  Since we're trying to catch all exceptions, use "Exception" there to catch any exception.

Comment 4 Michael Mráka 2013-10-17 07:12:30 UTC
Fixed in spacewalk master by
commit 60cf0271cc8a32b709b6f66161938fa03bede4d4
    1018929 - removed redundant exception
    both sections just re-raise exception as RepoError

Comment 6 Toshio Ernie Kuratomi 2013-10-18 16:44:25 UTC
Fix looks good to me.

Comment 9 Matej Kollar 2015-03-02 15:18:16 UTC
Cherry-picked as

Satellite.git: 9a4b0172f5f12c0aefb65161c425bd5ddb7c5fba

Comment 11 Pavel Studeník 2015-03-12 15:19:18 UTC
Reproducer with yum-rhn-plugin-0.9.1-50.el6.noarch

I can't find correctly steps to reproduce. I edit code to get a traceback. 

# vim /usr/share/yum-plugins/rhnplugin.py 
try:
   li = up2dateAuth.getLoginInfo(timeout=self.timeout)
--->
   # create some other traceback: IndexError..
   test = []
   print test[1]
--->
   except up2dateErrors.RhnServerException, e:
      raise yum.Errors.RepoError(unicode(e)), None, sys.exc_info()[2]
   except e:
     raise yum.Errors.RepoError(unicode(e)), None, sys.exc_info()[2]

# yum repolist 

Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 294, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 146, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 438, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 861, in doCommand
    base.repos.populateSack()
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 319, in populateSack
    sack.populate(repo, mdtype, callback, cacheonly)
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 165, in populate
    if self._check_db_version(repo, mydbtype):
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 223, in _check_db_version
    return repo._check_db_version(mdtype)
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1260, in _check_db_version
    repoXML = self.repoXML
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1459, in <lambda>
    repoXML = property(fget=lambda self: self._getRepoXML(),
  File "/usr/share/yum-plugins/rhnplugin.py", line 567, in _getRepoXML
    return YumRepository._getRepoXML(self)
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1451, in _getRepoXML
    self._loadRepoXML(text=self)
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1441, in _loadRepoXML
    return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1416, in _groupLoadRepoXML
    if self._commonLoadRepoXML(text):
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1234, in _commonLoadRepoXML
    result = self._getFileRepoXML(local, text)
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 1012, in _getFileRepoXML
    size=102400) # setting max size as 100K
  File "/usr/share/yum-plugins/rhnplugin.py", line 389, in _getFile
    start, end, copy_local, checkfunc, text, reget, cache, size)
  File "/usr/share/yum-plugins/rhnplugin.py", line 421, in _noExceptionWrappingGet
    self.setupRhnHttpHeaders()
  File "/usr/share/yum-plugins/rhnplugin.py", line 365, in setupRhnHttpHeaders
    except e:
UnboundLocalError: local variable 'e' referenced before assignment

Comment 12 Pavel Studeník 2015-03-12 15:24:55 UTC
Verified with yum-rhn-plugin-0.9.1-54.el6.noarch

# yum update
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Update Process
Error: Cannot retrieve repository metadata (repomd.xml) for repository: rhel-x86_64-server-6. Please verify its path and try again

Comment 13 errata-xmlrpc 2015-07-22 07:25:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1390.html


Note You need to log in before you can comment on or make changes to this bug.