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 746264

Summary: “exception caught in subscription-manager” while using config remove
Product: Red Hat Enterprise Linux 5 Reporter: spandey
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.7CC: alikins, jmolet, jsefler, kbanerje, skallesh, spandey, wpoteat
Target Milestone: beta   
Target Release: 5.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-21 06:42: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: 715031    

Description spandey 2011-10-14 15:04:56 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
3/3

Prerequisites:
Rhel6.2 client with following rpm 
subscription-manager-firstboot-0.96.15-1.el6.x86_64
.
subscription-manager-gnome-0.96.15-1.el6.x86_64.

subscription-manager-0.96.15-1.el6.x86_64
.


Steps to Repro : 
Execute Following command on client console 
 subscription-manager config --remove  --server.hostname=10.65.193.160

Expected Result : 
Usage should display for config.

Actual Result : 
[root@rhel62beta ~]# subscription-manager config --remove  --server.hostname=10.65.193.160
exception caught in subscription-manager


rhsm.log 

2011-10-14 12:20:09,561 [INFO]  @connection.py:350 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
2011-10-14 12:20:09,563 [DEBUG]  @connection.py:188 - Loading CA PEM certificates from: /etc/rhsm/ca/
2011-10-14 12:20:09,563 [DEBUG]  @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-ca.pem'
2011-10-14 12:20:09,563 [DEBUG]  @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2011-10-14 12:20:09,564 [DEBUG]  @connection.py:171 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2011-10-14 12:20:09,565 [WARNING]  @connection.py:383 - Error fetching supported resources, this UEPConnection is likely not usable:
2011-10-14 12:20:09,565 [ERROR]  @connection.py:385 - No such file or directory
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 376, in _load_supported_resources
    resources_list = self.conn.request_get("/")
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 252, in request_get
    return self._request("GET", method)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 191, in _request
    context.load_cert(self.cert_file, keyfile=self.key_file)
  File "/usr/lib64/python2.6/site-packages/M2Crypto/SSL/Context.py", line 76, in load_cert
    m2.ssl_ctx_use_cert(self.ctx, certfile)
SSLError: No such file or directory
2011-10-14 12:20:09,566 [INFO]  @connection.py:362 - Connection Established: host: 10.65.193.160, port: 8443, handler: /candlepin
2011-10-14 12:20:09,566 [ERROR]  @managercli.py:65 - exception caught in subscription-manager
2011-10-14 12:20:09,567 [ERROR]  @managercli.py:66 - No section: '--server'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 78, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 69, in main
    return managercli.CLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1370, in main
    cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 233, in main
    self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1126, in _do_command
    self._validate_options()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1118, in _validate_options
    for key, value in cfg.items(section):
  File "/usr/lib/python2.6/site-packages/iniparse/compat.py", line 267, in items
    raise NoSectionError(section)
NoSectionError: No section: '--server'

Comment 2 Bryan Kearney 2011-10-14 16:26:15 UTC
In the logs: 

2011-10-14 12:23:53,625 [ERROR]  @managercli.py:65 - exception caught in subscription-manager
2011-10-14 12:23:53,625 [ERROR]  @managercli.py:66 - No section: '--server'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 78, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 69, in main
    return managercli.CLI().main()
  File "/home/bkearney/code/subscription-manager/src/subscription_manager/managercli.py", line 1370, in main
    cmd.main()
  File "/home/bkearney/code/subscription-manager/src/subscription_manager/managercli.py", line 233, in main
    self._do_command()
  File "/home/bkearney/code/subscription-manager/src/subscription_manager/managercli.py", line 1126, in _do_command
    self._validate_options()
  File "/home/bkearney/code/subscription-manager/src/subscription_manager/managercli.py", line 1118, in _validate_options
    for key, value in cfg.items(section):
  File "/usr/lib/python2.7/site-packages/iniparse/compat.py", line 259, in items
    raise NoSectionError(section)
NoSectionError: No section: '--server'

Comment 3 Bryan Kearney 2011-10-18 15:50:22 UTC
*** Bug 747024 has been marked as a duplicate of this bug. ***

Comment 4 John Sefler 2011-10-30 03:18:02 UTC
The following branch commits by alikins fix this bug...

RHEL6.2 branch commit ed5f1172f33db33e97cbc5a6d3fe10ee97039557 by Adrian Likins
master branch commit bc4d620ae1a475a15cd89dcbc20742e2d45a9d79 by Adrian Likins

747024: restore previous behaviour for unhandled exceptions

As part of the change to handle unicode strings in error
messages, handle exception was changed to just pass
in handle_exceptions passed in msg. This changed behaviour
for some error cases, so return that, but ignore msgs
passed to systemExit that do not have string reprs.

Comment 5 John Sefler 2011-10-30 03:57:27 UTC
Verifying Version...
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.17-1.el6.x86_64

[root@jsefler-onprem-62server ~]# subscription-manager config --help | grep remove
List, set, or remove the configuration parameters in use by this machine.
  --remove=REMOVE       remove configuration entry by section.name

[root@jsefler-onprem-62server ~]# subscription-manager config --remove  --server.hostname=10.65.193.160
No section: '--server'

^^^^^^^^^^^^^^^^^^^^^^ This is the correct expected result because option --remove takes a value and "--server" is the following value for which there is no section in rhsm.conf by that name.

Changing the order of the options will correctly achieve the result spandey was looking for in comment 0...

[root@jsefler-onprem-62server ~]# subscription-manager config --server.hostname=10.65.193.160 --remove
Usage: subscription-manager config [OPTIONS]

subscription-manager: error: --remove option requires an argument


moving to VERIFIED

Comment 6 William Poteat 2012-01-23 13:19:33 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No description necessary

Comment 7 errata-xmlrpc 2012-02-21 06:42: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-2012-0154.html