Bug 765840

Summary: Wrong exception handling when registering with wrong credentials
Product: Red Hat Enterprise Linux 5 Reporter: Šimon Lukašík <slukasik>
Component: rhn-client-toolsAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.8CC: jpazdziora, msuchy
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 765790 Environment:
Last Closed: 2011-12-09 14:54:51 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: 765790    
Bug Blocks: 723481    

Description Šimon Lukašík 2011-12-09 14:44:55 UTC
+++ This bug was initially created as a clone of Bug #765790 +++

We have this regression in rhel5.8. With rhn


Description of problem:
There is a regression in a way, how the exceptions are handled
in the rhn-client-tools.

Previously, the error message was printed-out to the console.
Currently, only the name of exception is printed-out.

Version-Release number of selected component (if applicable):
rhn-client-tools-1.6.39-1.el5

How reproducible:
deterministic

Steps to Reproduce:
1. Register with wrong credentials
  # rhnreg_ks -v --username=admin --password=AAAAAA

Actual results:
An error has occurred:
exceptions.AttributeError
See /var/log/up2date for more information


Expected results:
Nice error message. Like in the old times.

Additional info:

--- Additional comment from jpazdziora on 2011-12-09 14:09:06 CET ---

I don't see it:

# rhnreg_ks -v --username asdf --password asdf --serverUrl http://localhost/XMLRPC > /dev/null
An error has occurred:
up2date_client.up2dateErrors.PasswordMinLengthError
See /var/log/up2date for more information
# rpm -qf /usr/sbin/rhnreg_ks
rhn-setup-1.6.39-1.el5
#

--- Additional comment from jpazdziora on 2011-12-09 14:09:49 CET ---

Can you please paste the content of /var/log/up2date?

--- Additional comment from jpazdziora on 2011-12-09 14:32:15 CET ---

With stock RHEL 5 packages, the traceback is even worse, so I'm at loss what nice error message you have in mind:

# rpm -qf /usr/sbin/rhnreg_ks 
rhn-setup-0.4.20-74.el5
# rhnreg_ks -v --username asdf --password asdf --serverUrl http://localhost/XMLRPC --force
An error has occurred:
up2date_client.up2dateErrors.AuthenticationOrAccountCreationError
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/share/rhn/up2date_client/rhncli.py", line 208, in __exceptionHandler
    log.log_exception(type, value, tb)
  File "/usr/share/rhn/up2date_client/up2dateLog.py", line 50, in log_exception
    output.append("%s: %s\n" % (type, value))
  File "/usr/lib/python2.4/site-packages/yum/Errors.py", line 32, in __str__
    return "%s" %(self.value,)
AttributeError: AuthenticationOrAccountCreationError instance has no attribute 'value'

Original exception was:
Traceback (most recent call last):
  File "/usr/sbin/rhnreg_ks", line 227, in ?
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 66, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhnreg_ks", line 95, in main
    self.options.password)
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 301, in reserveUser
    return s.registration.reserve_user(username, password)
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 52, in __call__
    raise self.__exception_from_fault(f)
up2date_client.up2dateErrors.AuthenticationOrAccountCreationError

--- Additional comment from slukasik on 2011-12-09 14:34:45 CET ---

Created attachment 544544 [details]
Behaviour of version rhn-setup-0.4.20-56.el5

Attached please find a snippet from /var/log/up2date.

# rhnreg_ks -v --username=admin --password=nimda  --force
An error has occurred:

Error Class Code: 3
Error Class Info: This login is already taken, or the password is incorrect.
Explanation: 
     An error has occurred while processing your request. If this problem
     persists please enter a bug report at bugzilla.redhat.com.
     If you choose to submit the bug report, please be sure to include
     details of what you were trying to do when this error occurred and
     details on how to reproduce this problem.

See /var/log/up2date for more information

--- Additional comment from slukasik on 2011-12-09 14:35:17 CET ---

Created attachment 544545 [details]
Behaviour of version rhn-setup-1.6.39-1.el5

Attached please find a snippet from /var/log/up2date.

# rhnreg_ks -v --username=admin --password=nimda  --force
An error has occurred:
exceptions.AttributeError
See /var/log/up2date for more information

Comment 2 Šimon Lukašík 2011-12-09 14:54:51 UTC
Well, seems we have this fixed with latest:

    rhn-client-tools-0.4.20-75.el5

Sorry for the noise.