Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1333353 - verifytree fails with traceback when there are no groups in the repo
verifytree fails with traceback when there are no groups in the repo
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: yum-utils (Show other bugs)
7.2
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Michal Domonkos
Eva Mrakova
:
Depends On:
Blocks: 1465896 1466368
  Show dependency treegraph
 
Reported: 2016-05-05 06:59 EDT by Eva Mrakova
Modified: 2018-04-10 12:51 EDT (History)
6 users (show)

See Also:
Fixed In Version: yum-utils-1.1.31-44.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 12:50:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0919 None None None 2018-04-10 12:51 EDT

  None (edit)
Description Eva Mrakova 2016-05-05 06:59:42 EDT
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 08:14:18 EDT
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 18:19:37 EDT
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 10:47:08 EDT
(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 12:50:32 EDT
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.