Bug 1184912

Summary: yum-config-manager --add-repo fails with IndexError when no .repo files present
Product: Red Hat Enterprise Linux 7 Reporter: Martin Frodl <mfrodl>
Component: yum-utilsAssignee: Michal Domonkos <mdomonko>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: emrakova, vmukhame, zdenek.juran
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-utils-1.1.31-35.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1330003 (view as bug list) Environment:
Last Closed: 2016-11-04 00:13:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Frodl 2015-01-22 12:50:25 UTC
Description of problem:

When /etc/yum.repos.d contains no .repo files, yum-config-manager fails to add a new repository via the --add-repo option, producing a traceback.

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

Steps to Reproduce:

# for repo in /etc/yum.repos.d/*; do mv $repo $repo.disabled; done
# yum-config-manager --add-repo ceph.repo 
Loaded plugins: priorities, product-id
adding repo from: ceph.repo
Traceback (most recent call last):
  File "/usr/bin/yum-config-manager", line 209, in <module>
    grabber = yb.repos.listEnabled()[0].grabfunc            
IndexError: list index out of range

Comment 4 Zdenek Juran 2016-01-15 09:17:14 UTC
This also happens with yum-utils-1.1-30 in release 6.7

Comment 5 Zdenek Juran 2016-01-15 09:21:20 UTC
BTW you don't need to move repository definitions out it is enough to make them disabled by: yum-config-manager --disable <list-of-repos>

Comment 12 errata-xmlrpc 2016-11-04 00:13:34 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-2016-2187.html