Red Hat Bugzilla – Bug 1333353
verifytree fails with traceback when there are no groups in the repo
Last modified: 2018-04-10 12:51:59 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)
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
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
(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!
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