Bug 1225753

Summary: yum-config-manager should alter config file specified using -c option
Product: Red Hat Enterprise Linux 6 Reporter: Karel Srot <ksrot>
Component: yum-utilsAssignee: Valentina Mukhamedzhanova <vmukhame>
Status: CLOSED ERRATA QA Contact: Eva Mrakova <emrakova>
Severity: low Docs Contact:
Priority: medium    
Version: 6.6CC: emrakova, jherrman
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-utils-1.1.30-33.el6 Doc Type: Bug Fix
Doc Text:
The yum-config-manager utility previously altered the /etc/yum.conf file even if an alternate configuration file was specified using the "-c" option. With this update, yum-config-manager alters the appropriate configuration file.
Story Points: ---
Clone Of: 1075708 Environment:
Last Closed: 2016-05-10 21:32:02 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 Karel Srot 2015-05-28 07:49:47 UTC
We should consider fixing it in RHEL-6 too.

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

Description of problem:

similar to request in bug 1075706.

yum-config-manager should update config file provided on the command line (when provided) rather than /etc/yum.conf:

# cp /etc/yum.conf /tmp/yum.conf
# yum-config-manager --setopt='debuglevel=9' --save -c /tmp/yum.conf
# grep debuglevel /etc/yum.conf 
debuglevel=9
# grep debuglevel /tmp/yum.conf 
debuglevel=2


--- Additional comment from Valentina Mukhamedzhanova on 2015-04-07 09:50:40 EDT ---

Can be fixed with something like:

--- a/yum-config-manager.py
+++ b/yum-config-manager.py
@@ -155,10 +155,13 @@ if (not args and not opts.addrepo) or 'main' in args:
     print yb.fmtSection('main')
     print yb.conf.dump()
     if opts.save and hasattr(yb, 'main_setopts') and yb.main_setopts:
-        fn = '/etc/yum/yum.conf'
+        fn = opts.conffile
         if not os.path.exists(fn):
-            # Try the old default
-            fn = '/etc/yum.conf'
+            if fn == '/etc/yum/yum.conf':
+                # Try the old default
+                fn = '/etc/yum.conf'
+            else:
+                raise yum.Errors.ConfigError("Error accessing file for config %s" % fn)
         ybc = yb.conf
         writeRawConfigFile(fn, 'main', ybc.yumvar,
                            ybc.cfg.options, ybc.iteritems, ybc.optionobj,

Comment 5 errata-xmlrpc 2016-05-10 21:32:02 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/RHEA-2016-0837.html