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 1333353 - verifytree fails with traceback when there are no groups in the repo
Summary: verifytree fails with traceback when there are no groups in the repo
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: yum-utils
Version: 7.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Michal Domonkos
QA Contact: Eva Mrakova
URL:
Whiteboard:
Depends On:
Blocks: 1465896 1466368
TreeView+ depends on / blocked
 
Reported: 2016-05-05 10:59 UTC by Eva Mrakova
Modified: 2018-04-10 16:51 UTC (History)
6 users (show)

Fixed In Version: yum-utils-1.1.31-44.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 16:50:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0919 0 None None None 2018-04-10 16:51:59 UTC

Description Eva Mrakova 2016-05-05 10:59:42 UTC
Description of problem:
verifytree fails with traceback when there are no groups in the repo

Version-Release number of selected component (if applicable):
yum-utils-1.1.31-35.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. create a repo with no groups
2. run verifytree for the repo

Actual results:
# verifytree /tmp/tstrepo/
Loaded plugins: product-id
Checking repodata:
  verifying repomd.xml with yum
  verifying filelists checksum
  verifying primary checksum
  verifying other checksum
  verifying filelists_db checksum
  verifying primary_db checksum
  verifying other_db checksum
Checking groups (comps.xml):
  verifying comps.xml with yum
  verifying comps.xml grammar with xmllint
Traceback (most recent call last):
  File "/usr/bin/verifytree", line 288, in <module>
    rc = main()
  File "/usr/bin/verifytree", line 233, in main
    comps = newrepo.getGroups()
  File "/usr/lib/python2.7/site-packages/yum/yumRepo.py", line 1888, in getGroups
    return self._retrieveMD('group', retrieve_can_fail=True)
  File "/usr/lib/python2.7/site-packages/yum/yumRepo.py", line 1796, in _retrieveMD
    thisdata = self.repoXML.getData(mdtype)
  File "/usr/lib/python2.7/site-packages/yum/repoMDObject.py", line 208, in getData
    raise RepoMDError, "requested datatype %s not available" % type
yum.Errors.RepoMDError: requested datatype group not available


Expected results:
verifytree succeeds (or reports there are no groups)

Comment 1 Thom Carlin 2016-09-08 12:14:18 UTC
Possible workaround:
Change line 1888 in /usr/lib/python2.7/site-packages/yum/yumRepo.py to:
-----------------------------
        try:
            return self._retrieveMD('group', retrieve_can_fail=True)
        except Errors.RepoMDError, e:
            return None
-----------------------------
Needs review though

Comment 2 Andrey 2017-06-28 22:19:37 UTC
The bug is still reproducible on 7.3 with
yum-3.4.3-150.el7.centos.noarch
yum-utils-1.1.31-40.el7.noarch

Luckily, there is --nocomps/--nogroups option available for verifytree as a workaround.

A patch, based on Thom's suggestion, should help:
--- yum/yumRepo.py.orig 2016-11-15 10:30:22.000000000 -0500
+++ yum/yumRepo.py      2017-06-28 18:04:10.471172343 -0400
@@ -1904,7 +1904,10 @@
                     logger.warning(e)
                     fn = None
             return fn
-        return self._retrieveMD('group', retrieve_can_fail=True)
+        try:
+            return self._retrieveMD('group', retrieve_can_fail=True)
+        except Errors.RepoMDError, e:
+            return None

     def setCallback(self, callback, multi_callback=None):
         self.callback = callback

Comment 6 Michal Domonkos 2017-10-23 14:47:08 UTC
(In reply to Thom Carlin from comment #1)
> Possible workaround:
> Change line 1888 in /usr/lib/python2.7/site-packages/yum/yumRepo.py to:
> -----------------------------
>         try:
>             return self._retrieveMD('group', retrieve_can_fail=True)
>         except Errors.RepoMDError, e:
>             return None
> -----------------------------
> Needs review though

Yes, this would prevent the traceback but verifytree would still proceed with running xmllint which would fail because of being passed the "None" file argument.

Whereas semantically, this is a "missing comps file" error which we already handle a bit earlier during the my.comps call; but it only works if group_command != 'objects' and doesn't fail otherwise.  Calling getGroups() there as well (and handling RepoMDError) is what we should do to fix this, see:

https://github.com/rpm-software-management/yum-utils/pull/31

Anyway, thanks for the patch, Thom!

Comment 11 errata-xmlrpc 2018-04-10 16:50:32 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://access.redhat.com/errata/RHBA-2018:0919


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