Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 927350

Summary: subscription-manager config --remove behaves differently on rhel5 and rhel6 versus rhel7
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED NOTABUG QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.10CC: alikins, awood, bkearney, jgalipea, wpoteat
Target Milestone: beta   
Target Release: 5.10   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-22 22:46: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:
Bug Depends On:    
Bug Blocks: 840995, 920191    

Description John Sefler 2013-03-25 17:46:28 UTC
Description of problem:
Using the same builds of subscription-manager on rhel5, rhel6, and rhel7, the feedback results given by a call to subscription-manager config --remove are different.  Note that all three systems begin without a [server] autoattachinterval that is not set in rhsm.conf.


RHEL7................................
[root@jsefler-7 ~]# subscription-manager config | head -2
[server]
   autoattachinterval = [1440]
[root@jsefler-7 ~]# subscription-manager config --remove=server.autoattachinterval
Section server and name autoattachinterval cannot be removed.


RHEL6................................
[root@rhsm-compat-rhel63 ~]# subscription-manager config | head -2
[server]
   autoattachinterval = [1440]
[root@rhsm-compat-rhel63 ~]# subscription-manager config --remove=server.autoattachinterval
You have removed the value for section server and name autoattachinterval.
The default value for autoattachinterval will now be used.


RHEL5................................
[root@rhsm-compat-rhel59 ~]# subscription-manager config | head -2
[server]
   autoattachinterval = [1440]
[root@rhsm-compat-rhel59 ~]# subscription-manager config --remove=server.autoattachinterval
You have removed the value for section server and name autoattachinterval.
The default value for autoattachinterval will now be used.




The RHEL7 results state:
   Section server and name autoattachinterval cannot be removed.
while the RHEL5 and RHEL6 results state:
   You have removed the value for section server and name autoattachinterval.
   The default value for autoattachinterval will now be used.

Why is there a difference?  The RHEL 7 results seem more accurate.  Should I update our automated tests to tolerate this difference in behavior?



Version-Release number of selected component (if applicable):
[root@jsefler-7 ~]# rpm -q subscription-manager
subscription-manager-1.8.4-1.git.36.80a2bf7.el7.x86_64
[root@rhsm-compat-rhel64 ~]# rpm -q subscription-manager
subscription-manager-1.8.4-1.git.36.80a2bf7.el6.x86_64
[root@rhsm-compat-rhel59 ~]# rpm -q subscription-manager
subscription-manager-1.8.4-1.git.36.80a2bf7.el5

Comment 2 RHEL Program Management 2013-04-09 20:56:50 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 3 Bryan Kearney 2013-05-01 19:42:14 UTC
This is due to the fact that you are trying to remove an item from a section which does not exist. That is combined with the fact that the defaults do not know what section they live in. 

TBH.. I am willing to not fix this. Looking for input from adrian and will.

Comment 4 Adrian Likins 2013-05-01 20:43:41 UTC
I think this may need a closer look, that error from RHEL7 should only
happen if there was an exception changing the config. It's a catch all
exception with no logging, so it could be hiding something more sinister.
(Or, it could just be a ConfigParser no section exception).

Comment 5 Bryan Kearney 2013-05-01 20:47:31 UTC
it is a no key error. We only check if the value is in the defaults. The defaults are not scoped by section. I bet if he passed in rhsmcertd.autoattachinterval it would be fine. I am guessing older items failed this quietly.

Comment 6 Adrian Likins 2013-07-22 21:07:13 UTC
Looks like behaviour changes in the config parsing lib (python-iniparse in this case). 

RHEL6 is at python-iniparse-0.3.1-2.1.el6.noarch, RHEL7 is at 0.4.7.

Changelog for python-iniparse:

------------------------------------------------------------------------
r142 | psoberoi | 2010-06-12 12:19:21 -0400 (Sat, 12 Jun 2010) | 2 lines

update changelog and change version number for 0.4 release

------------------------------------------------------------------------
r141 | psoberoi | 2010-05-08 15:58:40 -0400 (Sat, 08 May 2010) | 5 lines

Accessing non-existing sections using the container notation
(i.e. cfg['foo']['bar']) will auto-create the sections.  This
has always been the behavior for dotted access, but so far
container access used to raise a KeyError exception.

------------------------------------------------------------------------
r140 | tim.lauridsen | 2010-05-08 06:48:34 -0400 (Sat, 08 May 2010) | 1 line

added the missing new iniparse/utils.py
------------------------------------------------------------------------
r139 | tim.lauridsen | 2010-05-08 03:00:44 -0400 (Sat, 08 May 2010) | 1 line

move tidy to utils.py to avoid circular imports
------------------------------------------------------------------------
r138 | psoberoi | 2010-05-07 12:04:34 -0400 (Fri, 07 May 2010) | 4 lines

prevent lokups of __special__ methods from invoking the automatic
config addition machinery, and remove the special hacks for __getattr__,
__reduce__, __reduce_ex__, and __getnewargs__.