Bug 702107

Summary: [RHEL6] rhn-channel -L should emit cogent error message rather than backtrace when run on a host where the login user does not have RHN Org Admin privs.
Product: Red Hat Enterprise Linux 6 Reporter: Travis Gummels <tgummels>
Component: rhn-client-toolsAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Šimon Lukašík <slukasik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: ksugawar, mminar, slukasik
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: HTB
Fixed In Version: rhn-client-tools-1.0.0-64.el6 Doc Type: Bug Fix
Doc Text:
Previously, running the "rhn-channel -L" command with an incorrect username or password or as a user without permissions to administer the system in question caused it to terminate unexpectedly with a traceback. The rhn-channel utility has been corrected to display an appropriate error message in this situation.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 16:49:28 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:

Description Travis Gummels 2011-05-04 19:16:44 UTC
Description of problem:

rhn-channel -L should emit cogent error message rather than backtrace when run on a host where the login user does not have RHN Org Admin privs.  User has root access to host, registers system but does not have Org Admin privs in RHN.  The following output is emitted when rhn-channel -L is executed:

[root@rhel6 etc]# rhn-channel -L
Username: mgrondona
Password:
Traceback (most recent call last):
File "/usr/sbin/rhn-channel", line 141, in <module>
main()
File "/usr/sbin/rhn-channel", line 133, in main
channels = get_available_channels(OPTIONS.user, OPTIONS.password)
File "/usr/sbin/rhn-channel", line 93, in get_available_channels
for channel in client.system.listChildChannels(key, int(system_id)):
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -208: 'No such system'> 


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

rhn-setup-1.0.0-61.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. Register system to RHN
2. As a non Org Admin user attempt to execute rhn-channel -L
3.
  
Actual results:

Backtrace

Expected results:

A meaningful error message.

Additional info:

Comment 1 Milan Zázrivec 2011-08-03 09:55:22 UTC
spacewalk.git master: f54af17a889ab9e5a56e34cc81787aede9f87ce6
satellite.git CLIENT-RHEL-6: 16b9d376161cc7843c9d66ebfa3bc8d9ec6a27ae

Comment 3 Milan Zázrivec 2011-08-08 15:14:47 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:
Cause: A bug in rhn-client-tools code.

Consequence: rhn-channel utility would display a traceback in cases the login used did not have permissions to manipulate the system in question.

Fix: The fix was quite easy.

Result: rhn-channel utility now displays a cogent error message in the problematic situations.

Comment 4 Šimon Lukašík 2011-08-10 08:51:08 UTC
Switching to Verified:

Testing procedure:
- rhn-channel -L -- against RHN Satellite
- rhn-channel -L -- against RHN Hosted

Result:
- The error message is omitted against Satellite:
    Error when listing child channels:
    redstone.xmlrpc.XmlRpcFault: No such system - sid = 1000010052
- The error message is ommited against RHN Hosted
    Error when listing child channels: No such system
- Non zero value is returned in both cases

Verified against:
rhn-setup-1.0.0-65.el6.noarch
rhn-client-tools-1.0.0-65.el6.noarch

Comment 5 Milan Zázrivec 2011-08-26 08:55:30 UTC
*** Bug 733609 has been marked as a duplicate of this bug. ***

Comment 6 Jaromir Hradilek 2011-10-27 16:27:47 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1 @@
-Cause: A bug in rhn-client-tools code.
+Previously, running the "rhn-channel -L" command with an incorrect username or password or as a user without permissions to administer the system in question caused it to terminate unexpectedly with a traceback. The rhn-channel utility has been corrected to display an appropriate error message in this situation.-
-Consequence: rhn-channel utility would display a traceback in cases the login used did not have permissions to manipulate the system in question.
-
-Fix: The fix was quite easy.
-
-Result: rhn-channel utility now displays a cogent error message in the problematic situations.

Comment 7 errata-xmlrpc 2011-12-06 16:49:28 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-1664.html