Bug 1110271 - incorrect error handling: 'exceptions.ValueError' object has no attribute 'msg'
Summary: incorrect error handling: 'exceptions.ValueError' object has no attribute 'msg'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-rhsm
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel66
TreeView+ depends on / blocked
 
Reported: 2014-06-17 10:46 UTC by Jan Hutař
Modified: 2014-10-14 07:47 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
no documentation required
Clone Of:
Environment:
Last Closed: 2014-10-14 07:47:13 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1384 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2014-10-14 01:27:50 UTC

Description Jan Hutař 2014-06-17 10:46:43 UTC
Description of problem:
There is incorrect error handling in subscription-manager. I have seen it to report "'exceptions.ValueError' object has no attribute 'msg'" instead of reasonable error message.


Version-Release number of selected component (if applicable):
subscription-manager-1.9.11-1.el6.x86_64
python-rhsm-1.9.6-1.el6.x86_64


How reproducible:
rarely


Steps to Reproduce:
1. I'm unable to reproduce the issue now. Seen it only once.
   # subscription-manager register --force --username <user> --password <pass>


Actual results:
'exceptions.ValueError' object has no attribute 'msg'
The system has been registered with ID: <systemID>


Expected results:
Correct error should be displayed.


Additional info:
Relevant part from the log:

[...]
2014-06-17 04:29:55,516 [DEBUG]  @connection.py:402 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2014-06-17 04:29:55,517 [DEBUG]  @connection.py:441 - Making request: GET /subscription/consumers/d4aae02e-6638-42bd-8170-4d51f6fbc461/compliance
2014-06-17 04:29:58,228 [DEBUG]  @connection.py:460 - Response status: 502
2014-06-17 04:29:58,228 [ERROR]  @connection.py:489 - Response: 502
2014-06-17 04:29:58,229 [ERROR]  @managercli.py:151 - exception caught in subscription-manager
2014-06-17 04:29:58,229 [ERROR]  @managercli.py:152 - 'exceptions.ValueError' object has no attribute 'msg'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 82, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 73, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2253, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 166, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 441, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1115, in _do_command
    self._request_validity_check()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 244, in _request_validity_check
    inj.require(inj.CERT_SORTER).force_cert_check()
  File "/usr/share/rhsm/subscription_manager/injection.py", line 98, in require
    return FEATURES.require(feature, *args, **kwargs)
  File "/usr/share/rhsm/subscription_manager/injection.py", line 72, in require
    self.providers[feature] = provider()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 321, in __init__
    super(CertSorter, self).__init__()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 66, in __init__
    self.load()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 116, in load
    self._parse_server_status()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 135, in _parse_server_status
    status = self.get_compliance_status()
  File "/usr/share/rhsm/subscription_manager/cert_sorter.py", line 333, in get_compliance_status
    return status_cache.load_status(self.cp_provider.get_consumer_auth_cp(), self.identity.uuid)
  File "/usr/share/rhsm/subscription_manager/cache.py", line 216, in load_status
    self._sync_with_server(uep, uuid)
  File "/usr/share/rhsm/subscription_manager/cache.py", line 201, in _sync_with_server
    self.server_status = uep.getCompliance(uuid)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 817, in getCompliance
    return self.conn.request_get(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 541, in request_get
    return self._request("GET", method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 469, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 490, in validateResponse
    log.error("JSON parsing error: %s" % e.msg)
AttributeError: 'exceptions.ValueError' object has no attribute 'msg'
2014-06-17 04:29:58,452 [DEBUG]  @plugins.py:519 - loaded plugin modules: []
2014-06-17 04:29:58,452 [DEBUG]  @plugins.py:520 - loaded plugins: {}
[...]

Comment 1 John Sefler 2014-06-24 14:30:29 UTC
I believe this bug was fixed here: 
https://bugzilla.redhat.com/show_bug.cgi?id=1008808#c10
https://bugzilla.redhat.com/show_bug.cgi?id=1008808#c15

Please re-test with the latest python-rhsm package version targeted for rhel6.6:
  python-rhsm-1.12.2-1.el6

Comment 2 Jan Hutař 2014-06-24 22:20:02 UTC
(In reply to John Sefler from comment #1)
> I believe this bug was fixed here: 
> https://bugzilla.redhat.com/show_bug.cgi?id=1008808#c10
> https://bugzilla.redhat.com/show_bug.cgi?id=1008808#c15
> 
> Please re-test with the latest python-rhsm package version targeted for
> rhel6.6:
>   python-rhsm-1.12.2-1.el6

Looking at the bug, it was filled against RHEL7, but traceback in it seems to be very similar to what I have seen.

I was unable to reproduce the faulty situation, so can not test python-rhsm-1.12.2-1.el6.

Comment 3 Bryan Kearney 2014-08-07 14:19:35 UTC
John is correct. Fixed by 1008808. If you can not reproduce please close.

Comment 4 Shwetha Kallesh 2014-08-08 18:07:34 UTC
Moving to verified!

[root@dhcp-0-177 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.23-1
subscription management rules: 5.11
subscription-manager: 1.12.11-1.el6
python-rhsm: 1.12.5-1.el6


Tried registering with an invalid user :

[root@dhcp-0-177 ~]# subscription-manager register --org admin --force
Username: hello
Password: 
Invalid username or password. To create a login, please visit https://www.redhat.com/wapps/ugc/register.html


Register with proper username :

[root@dhcp-0-177 ~]# subscription-manager register --force
The system with UUID 53fc150a-4261-47f1-8aaf-58954c2f26fd has been unregistered
Username: admin
Password: 
Organization: admin
The system has been registered with ID: 6788a5cb-8d3d-45e7-aaed-93624ffa45a7

Comment 5 errata-xmlrpc 2014-10-14 07:47:13 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-2014-1384.html


Note You need to log in before you can comment on or make changes to this bug.