Bug 842885 - AttributeError: RemoteServerException instance has no attribute 'args'; thrown when registering with --serverurl containing bad prefix
Summary: AttributeError: RemoteServerException instance has no attribute 'args'; throw...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: python-rhsm
Version: 5.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Entitlement Bugs
URL:
Whiteboard:
Depends On:
Blocks: 771748
TreeView+ depends on / blocked
 
Reported: 2012-07-24 20:21 UTC by John Sefler
Modified: 2013-01-08 07:17 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: An unimplemented method in an error class. Consequence: A traceback was being printed to the console obscuring the actual error message. Fix: Implementing the missing method on the error class. Result: The error message is now reported successfully.
Clone Of:
Environment:
Last Closed: 2013-01-08 07:17:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0039 0 normal SHIPPED_LIVE python-rhsm bug fix update 2013-01-07 15:28:26 UTC

Description John Sefler 2012-07-24 20:21:43 UTC
Description of problem:
When specifying a --serverurl with a bad prefix, a traceback is thrown for the page not found error.


Version-Release number of selected component (if applicable):
[root@jsefler-rhel59 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.0.9-1.git.37.53fde9a.el5
python-rhsm-1.0.3-1.git.2.47dc8f4.el5


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel59 ~]# subscription-manager register --username=stage_test_12 --force --serverurl=https://subscription.rhn.stage.redhat.com:443/PREFIX
Traceback (most recent call last):
  File "/usr/lib64/python2.4/logging/handlers.py", line 71, in emit
    if self.shouldRollover(record):
  File "/usr/lib64/python2.4/logging/handlers.py", line 149, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/usr/lib64/python2.4/logging/__init__.py", line 617, in format
    return fmt.format(record)
  File "/usr/lib64/python2.4/logging/__init__.py", line 405, in format
    record.message = record.getMessage()
  File "/usr/lib64/python2.4/logging/__init__.py", line 272, in getMessage
    msg = str(self.msg)
AttributeError: RemoteServerException instance has no attribute 'args'
Unable to reach the server at subscription.rhn.stage.redhat.com:443/PREFIX
[root@jsefler-rhel59 ~]# 

DID NOT EXPECT THE AttributeError.
ONLY EXPECTED:
Unable to reach the server at subscription.rhn.stage.redhat.com:443/PREFIX


Additional info:
[root@jsefler-rhel59 ~]# tail -f /var/log/rhsm/rhsm.log
2012-07-24 16:17:03,172 [INFO]  @connection.py:502 - Using no auth
2012-07-24 16:17:03,173 [INFO]  @connection.py:505 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /PREFIX
2012-07-24 16:17:03,173 [DEBUG]  @connection.py:317 - Loading CA PEM certificates from: /etc/rhsm/ca/
2012-07-24 16:17:03,173 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/redhat-uep.pem'
2012-07-24 16:17:03,174 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/jsefler-f14-candlepin.pem'
2012-07-24 16:17:03,174 [DEBUG]  @connection.py:299 - Loading CA certificate: '/etc/rhsm/ca/candlepin-stage.pem'
2012-07-24 16:17:03,174 [DEBUG]  @connection.py:338 - Making request: GET /PREFIX/status/
2012-07-24 16:17:03,593 [DEBUG]  @connection.py:351 - Response status: 404
2012-07-24 16:17:03,594 [ERROR]  @connection.py:368 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/rhsm/connection.py", line 366, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.4/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.4/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.4/site-packages/simplejson/decoder.py", line 353, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
2012-07-24 16:17:03,597 [ERROR]  @connection.py:369 - Response: {'content': '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /PREFIX/status/ was not found on this server.</p>\n<hr>\n<address>Apache Server at subscription.rhn.stage.redhat.com Port 443</address>\n</body></html>\n', 'status': 404}
2012-07-24 16:17:03,598 [ERROR]  @connection.py:371 - remote server status code: 404

Comment 1 RHEL Program Management 2012-07-24 20:38:20 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 2 Adrian Likins 2012-08-01 20:14:57 UTC

*** This bug has been marked as a duplicate of bug 830767 ***

Comment 3 John Sefler 2012-08-02 14:11:25 UTC
Nope, this is not exactly a duplicate...

bug 830767 now appears to pass, but my case still fails...

[root@jsefler-rhel59 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.0.11-1.git.11.4d6cb5a.el5
python-rhsm-1.0.4-1.git.7.47e5112.el5

[root@jsefler-rhel59 ~]# subscription-manager config --server.insecure=1
[root@jsefler-rhel59 ~]# subscription-manager register --username=testuser1 --password=password --org=admin --serverurl=/
Unable to reach the server at subscription.rhn.redhat.com:443/

^^^ bug 830767 VERIFIED

[root@jsefler-rhel59 ~]# subscription-manager register --username=testuser1 --password=password --org=admin --serverurl=https://jsefler-f14-candlepin.usersys.redhat.com:8443/PREFIX
Traceback (most recent call last):
  File "/usr/lib64/python2.4/logging/handlers.py", line 71, in emit
    if self.shouldRollover(record):
  File "/usr/lib64/python2.4/logging/handlers.py", line 149, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/usr/lib64/python2.4/logging/__init__.py", line 617, in format
    return fmt.format(record)
  File "/usr/lib64/python2.4/logging/__init__.py", line 405, in format
    record.message = record.getMessage()
  File "/usr/lib64/python2.4/logging/__init__.py", line 272, in getMessage
    msg = str(self.msg)
AttributeError: NetworkException instance has no attribute 'args'
Unable to reach the server at jsefler-f14-candlepin.usersys.redhat.com:8443/PREFIX

^^^ this bug still fails

[root@jsefler-rhel59 ~]# tail -f /var/log/rhsm/rhsm.log
2012-08-02 10:08:42,239 [INFO]  @connection.py:505 - Using no auth
2012-08-02 10:08:42,240 [INFO]  @connection.py:508 - Connection Built: host: jsefler-f14-candlepin.usersys.redhat.com, port: 8443, handler: /PREFIX
2012-08-02 10:08:42,240 [DEBUG]  @connection.py:341 - Making request: GET /PREFIX/status/
2012-08-02 10:08:42,268 [DEBUG]  @connection.py:354 - Response status: 400
2012-08-02 10:08:42,269 [ERROR]  @connection.py:371 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib64/python2.4/site-packages/rhsm/connection.py", line 369, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.4/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.4/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.4/site-packages/simplejson/decoder.py", line 353, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
2012-08-02 10:08:42,276 [ERROR]  @connection.py:372 - Response: {'content': '', 'status': 400}

Comment 4 Adrian Likins 2012-08-02 16:34:16 UTC
Indeed, 400 causes a NetworkException, which is the same problem class
as 830767. 

Fixed it for NetworkException, and added some test cases for it

(pull request https://github.com/candlepin/python-rhsm/pull/25)


commit d15c8d24a814f5c14ea28a33735c056a1657f678
Author: Adrian Likins <alikins>
Date:   Thu Aug 2 11:38:16 2012 -0400

    842885: add __str__ to NetworkException, ala  #830767
    
    Add some test cases to verify we shouldn't have
    any other issues like this.

Comment 5 Adrian Likins 2012-08-15 17:06:39 UTC
Merge to master python-rhsm, fix should be in 1.0.5-1

Comment 7 RHEL Program Management 2012-08-21 17:39:18 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 8 John Sefler 2012-09-20 20:03:44 UTC
Verifying Version...
[root@rhsm-accept-rhel5 rhsm]# rpm -q subscription-manager python-rhsm
subscription-manager-1.0.18-1.el5
python-rhsm-1.0.8-1.el5

[root@rhsm-accept-rhel5 rhsm]# subscription-manager register --username=testuser1 --password=password --org=admin --serverurl=https://jsefler-f14-candlepin.usersys.redhat.com:8443/PREFIX
Error: CA certificate for subscription service has not been installed.

[root@rhsm-accept-rhel5 rhsm]# subscription-manager config --server.insecure=1

[root@rhsm-accept-rhel5 rhsm]# subscription-manager register --username=testuser1 --password=password --org=admin --serverurl=https://jsefler-f14-candlepin.usersys.redhat.com:8443/PREFIX
Unable to reach the server at jsefler-f14-candlepin.usersys.redhat.com:8443/PREFIX

^^^ VERIFIED

Comment 10 errata-xmlrpc 2013-01-08 07:17:24 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-2013-0039.html


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