Bug 1095161

Summary: yum-config-manager --setopt doesn't work with wildcards
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: james.antill, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-3.4.3-119.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1094373
: 1129590 (view as bug list) Environment:
Last Closed: 2015-03-05 09:03:58 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:
Bug Depends On:    
Bug Blocks: 1129590    

Description Karel Srot 2014-05-07 08:37:41 UTC
Same problems as in RHEL-6 bug 1094373.
yum-3.4.3-117.el7.noarch 

+++ This bug was initially created as a clone of Bug #1094373 +++

Description of problem:

# rpm -q yum
yum-3.2.29-51.el6.noarch

# yum-config-manager --setopt '*.retries=11' repoBlah1 repoBlah2 | egrep '(\[repoBlah|retries)'
[repoBlah1]
retries = 10
[repoBlah2]
retries = 10

# yum-config-manager --setopt 'repoBlah*.retries=11' repoBlah1 repoBlah2 | egrep '(\[repoBlah|retries)'
[repoBlah1]
retries = 10
[repoBlah2]
retries = 10

# yum-config-manager --setopt 'repoBlah1.retries=11' repoBlah1 repoBlah2 | egrep '(\[repoBlah|retries)'
[repoBlah1]
retries = 11
[repoBlah2]
retries = 10

Also, the --setopt parsing could be a bit more tolerant to the provided input.

# yum-config-manager --setopt 'repoBlah1.retries = 11' repoBlah1 repoBlah2 | egrep '(\[repoBlah|retries)'
Repo repoBlah1 did not have a retries  attr. before setopt
[repoBlah1]
retries = 10
retries  =  11
[repoBlah2]
retries = 10

Comment 2 Valentina Mukhamedzhanova 2014-08-13 09:45:06 UTC
Here is the upstream commit for fixing the spaces handling part. Everything else will be fixed as part of bug 1129590 in yum-utils.

commit 0954b42554b7f78809d9050886b419a99e28d289
Author: Valentina Mukhamedzhanova <vmukhame>
Date:   Tue May 13 15:50:52 2014 +0200

    Make --setopt handle spaces properly. BZ 1094373

diff --git a/cli.py b/cli.py
index c1ef023..aa73278 100755
--- a/cli.py
+++ b/cli.py
@@ -193,7 +193,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             if len(vals) < 2:
                 bad_setopt_ne.append(item)
                 continue
-            k,v = vals
+            k, v = [i.strip() for i in vals]
             period = k.rfind('.')
             if period != -1:
                 repo = k[:period]

Comment 7 errata-xmlrpc 2015-03-05 09:03:58 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-2015-0398.html