Bug 1029359 - yum grouplist ignores skip_if_unavailable=1
yum grouplist ignores skip_if_unavailable=1
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: yum (Show other bugs)
6.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: packaging-team-maint
Karel Srot
:
Depends On:
Blocks: 1028455
  Show dependency treegraph
 
Reported: 2013-11-12 04:17 EST by Alon Bar-Lev
Modified: 2014-10-14 00:37 EDT (History)
7 users (show)

See Also:
Fixed In Version: yum-3.2.29-55.el6
Doc Type: Bug Fix
Doc Text:
Cause: have an unavailable repo with 'skip_if_unavailabe=1' and run 'yum grouplist' Consequence: yum sees an unavailable repo and exits Fix: patch Result: the unavailable repo with 'skip_if_unavailabe=1' is skipped and 'yum grouplist' works as expected
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-10-14 00:37:04 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)

  None (edit)
Description Alon Bar-Lev 2013-11-12 04:17:54 EST
Description of problem:

yum grouplist does not respect skip_if_unavailable=1 repository property, and fails when repository is unavailable.

Version-Release number of selected component (if applicable):
yum-3.2.29-40.el6.noarch

How reproducible:
Always.

Steps to Reproduce:
1. /etc/yum.repos.d/foobar.repo
---
[foobar]
name=foobar
baseurl=http://foobar
gpgcheck=0
enabled=1
skip_if_unavailable=1
---

2. yum clean expire-cache

3. yum grouplist

Actual results:

# yum grouplist

Loaded plugins: priorities, product-id, refresh-packagekit, rhnplugin, subscription-manager, versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Group Process
epel/metalink                                                                                                                                                          |  15 kB     00:00     
http://foobar/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'foobar'"
Trying other mirror.
http://foobar/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'foobar'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: foobar. Please verify its path and try again


Expected results:

Success even if foobar repo is unreachable.

# yum grouplist
Loaded plugins: priorities, product-id, refresh-packagekit, rhnplugin, subscription-manager, versionlock
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Group Process
is                                                                                                                                                                     | 1.3 kB     00:00     
rhel                                                                                                                                                                   | 4.0 kB     00:00     
rhel-x86_64-server-6                                                                                                                                                   | 1.8 kB     00:00     
sf                                                                                                                                                                     | 1.9 kB     00:00     
file:///root/alonbl/ovirt-engine-rhevm/output/3.3.0-0.101.20131019gitf41c0ae.root/repodata/repomd.xml: [Errno 14] Could not open/read file:///root/alonbl/ovirt-engine-rhevm/output/3.3.0-0.101.20131019gitf41c0ae.root/repodata/repomd.xml
Trying other mirror.
Installed Groups:
   Additional Development
   Base
   Client management tools
<snip>
   Zulu Support [zu]
Done
Comment 2 Zdeněk Pavlas 2013-11-12 04:43:08 EST
Reproduced the bug.  It's fixed upstream, as a side effect of the following 1-line commit.  Backporting fixed the bug in my reproducer.

commit 83b1afba634f361fefc7d9eef53133c501e58aeb
Author: James Antill <james@and.org>
Date:   Tue Jun 28 15:59:22 2011 -0400

     Don't call repo.doSetup() if we've already setup the repos. BZ 717163.
    
     Test: yum in @core == has    setup.
           yum rm @core == hasn't setup.

diff --git a/yum/__init__.py b/yum/__init__.py
index 92f25d4..2dce3bf 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -792,7 +792,9 @@ class YumBase(depsolve.Depsolve):
         self.verbose_logger.log(logginglevels.DEBUG_4,
                                 _('Getting group metadata'))
         reposWithGroups = []
-        self.repos.doSetup()
+        #  Need to make sure the groups data is ready to read. Really we'd want
+        # to add groups to the mdpolicy list of the repo. but we don't atm.
+        self.pkgSack
         for repo in self.repos.listGroupsEnabled():
             if repo.groups_added: # already added the groups from this repo
Comment 3 Alon Bar-Lev 2013-11-12 04:49:46 EST
Thanks for quick response!
Comment 10 Karel Srot 2014-07-01 05:56:14 EDT
VERIFIED
tested with /CoreOS/yum/Regression/bz1029359-yum-grouplist-ignores-skip_if_unavailable

yum-3.2.29-59.el6.noarch:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   PASS   ] :: Running 'yum --disablerepo=\* --enablerepo=bz1029359repo\* --noplugins grouplist &> log' (Expected 0, got 0)
:: [   PASS   ] :: File 'log' should contain 'test-group-a' 
:: [   LOG    ] :: Duration: 1s
:: [   LOG    ] :: Assertions: 2 good, 0 bad
:: [   PASS   ] :: RESULT: Test

yum-3.2.29-43.el6_5.noarch:


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   FAIL   ] :: Running 'yum --disablerepo=\* --enablerepo=bz1029359repo\* --noplugins grouplist &> log' (Expected 0, got 1)
Setting up Group Process
http://127.0.0.9/nosuchrepo/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
http://127.0.0.9/nosuchrepo/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: bz1029359repoA. Please verify its path and try again
:: [   FAIL   ] :: File 'log' should contain 'test-group-a' 
'52b322ff-dc77-4d7b-b718-d1802a05a93d'
Test result: FAIL
Comment 12 errata-xmlrpc 2014-10-14 00:37:04 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.

http://rhn.redhat.com/errata/RHBA-2014-1410.html

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