Bug 736784

Summary: subscription-manager config --remove adds config property to rhsm.conf if it doesn't exist
Product: Red Hat Enterprise Linux 6 Reporter: Michael Stead <mstead>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.2CC: jmolet, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 17:24:09 UTC Type: ---
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: 682238, 743047    

Description Michael Stead 2011-09-08 17:05:28 UTC
Description of problem:
When using the "config --remove section.property" option of subscription manager, if the specified property is NOT a default property, and is not in the config file, it will be added.

Version-Release number of selected component (if applicable):
subscription-manager-firstboot-0.96.9-1.git.4.3236ce3.el6.x86_64
subscription-manager-gnome-0.96.9-1.git.4.3236ce3.el6.x86_64
subscription-manager-0.96.9-1.git.4.3236ce3.el6.x86_64
subscription-manager-debuginfo-0.96.9-1.git.4.3236ce3.el6.x86_64


How reproducible:
always

Steps to Reproduce:

[root@mstead mstead]# cat /etc/rhsm/rhsm.conf | grep unknown_prop
[root@mstead mstead]# 
[root@mstead mstead]# sudo subscription-manager config --remove rhsmcertd.unknown_prop
You have removed the value for section rhsmcertd and name unknown_prop.
[root@mstead mstead]# 
[root@mstead mstead]# cat /etc/rhsm/rhsm.conf | grep unknown_prop
unknown_prop = 
[root@mstead mstead]# 

  
Actual results:
Received message "You have removed the value for section rhsmcertd and name unknown_prop." and the property was added to the config file with an empty value.

Expected results:
Receive a message stating that it could not be removed.


Additional info:

Comment 2 John Sefler 2011-09-08 20:40:39 UTC
Having discussed this with wpoteat earlier this week, I've learned that this behavior is a feature!  - albeit a harmless feature - a feature of the python library being used to read/set parameters.  Nevertheless a valid bug.

setting Severity to "low"...

Comment 3 William Poteat 2011-09-09 12:45:32 UTC
Actually, it should not add the entry on remove.

Added additional checking to stop this from happening.

Comment 5 John Sefler 2011-09-09 15:18:22 UTC
# rpm -q subscription-manager
subscription-manager-0.96.9-1.git.8.4e7d06b.el6.x86_64
# rpm -q python-rhsm
python-rhsm-0.96.11-1.git.7.4aaef6e.el6.noarch


# subscription-manager config --remove rhsmcertd.unknown-prop
exit expected at most 1 arguments, got 2


moving back to NEW/FailedQA...  I suspect a needed commit for python-rhsm has not happened yet.

Including a commit hash (in comment 3) is always helpful when moving a bug to MODIFIED.

Comment 7 J.C. Molet 2011-09-22 19:16:31 UTC
Now working as expected:


[root@jmolet-vm0 ~]# cat /etc/rhsm/rhsm.conf | grep unknown_prop
[root@jmolet-vm0 ~]# subscription-manager config --remove rhsmcertd.unknown_prop
Error: Section rhsmcertd and name unknown_prop does not exist.
[root@jmolet-vm0 ~]# cat /etc/rhsm/rhsm.conf | grep unknown_prop


python-rhsm-0.96.12-1.git.0.4862863.el6.noarch
subscription-manager-firstboot-0.96.11-1.git.1.945da16.el6.x86_64
subscription-manager-0.96.11-1.git.1.945da16.el6.x86_64
subscription-manager-gnome-0.96.11-1.git.1.945da16.el6.x86_64

Marking VERIFIED.

Comment 8 John Sefler 2011-09-25 00:32:44 UTC
[root@jsefler-onprem-62server ~]# subscription-manager config --remove rhsmcertd.unknown_prop 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-onprem-62server ~]# echo $?
255
[root@jsefler-onprem-62server ~]# cat /tmp/stderr
[root@jsefler-onprem-62server ~]# cat /tmp/stdout
Error: Section rhsmcertd and name unknown_prop does not exist.
[root@jsefler-onprem-62server ~]# 

moving back to ASSIGNED...
THE ERROR MESSAGE SHOULD BE WRITTEN TO STDERR NOT STDOUT.

Comment 9 William Poteat 2011-09-26 12:39:52 UTC
Written with sys.stderr.write for ConfigCommand errors.

Commit 600f2813db4471955e9f1efdfe4a5a1d270f7133

Comment 10 J.C. Molet 2011-09-26 15:51:41 UTC
[root@jmolet-vm0 ~]# subscription-manager config --remove rhsmcertd.unknown_prop 1> /tmp/stdout 2> /tmp/stderr
[root@jmolet-vm0 ~]# echo $?
255
[root@jmolet-vm0 ~]# cat /tmp/stderr 
Error: Section rhsmcertd and name unknown_prop does not exist.
[root@jmolet-vm0 ~]# cat /tmp/stdout 
[root@jmolet-vm0 ~]# 

errors are going to /tmp/stderr as they should now.

Tested against:
subscription-manager-0.96.11-1.git.9.b453a83.el6.x86_64

Comment 11 errata-xmlrpc 2011-12-06 17:24:09 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.

http://rhn.redhat.com/errata/RHBA-2011-1695.html