Bug 1122991 - trying to register using a non-existent environment/cv returns cryptic error in subscription-manager
Summary: trying to register using a non-existent environment/cv returns cryptic error ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: Unspecified
Assignee: Katello Bug Bin
QA Contact: sthirugn@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 14:29 UTC by Corey Welton
Modified: 2014-07-28 14:17 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-28 14:17:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Corey Welton 2014-07-24 14:29:54 UTC
Description of problem:
When a user tries to register to a sat6 instance, pointing to a non-existent env/cv, an error is thrown that makes no sense to user.  I am not sure if this is a sub-man issue, sat, or both

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

Satellite-6.0.4-RHEL-6-20140723.0
How reproducible:


Steps to Reproduce:
1.  Try and register a client to your system, using an environment/cv combination that does not exist, i.e. 

subscription-manager register --username admin --password yK75VcevtxLyEnuZ --org Default_Organization --environment dev/mycv --auto-attach --force
2. view results


Actual results:

[root@qeblade6 ~]# subscription-manager register --username admin --password yK75VcevtxLyEnuZ --org Default_Organization --environment dev/mycv --auto-attach --force
'exceptions.ValueError' object has no attribute 'msg'



Expected results:

Something that makes more sense to user.

Additional info:

Comment 1 Corey Welton 2014-07-24 14:33:32 UTC
subscription management server: 1.5.0-27.el6sat-Katello
subscription-manager: 1.9.11-1.el6
python-rhsm: 1.9.6-1.el6

Comment 2 Corey Welton 2014-07-24 14:39:39 UTC
Relevant rhsm.log snippet

2014-07-24 10:22:09,567 [DEBUG]  @connection.py:441 - Making request: GET /katello/api/owners/Default_Organization/environments?name=dev%2Fmycv
2014-07-24 10:22:09,668 [DEBUG]  @connection.py:460 - Response status: 404
2014-07-24 10:22:09,669 [ERROR]  @connection.py:489 - Response: 404
2014-07-24 10:22:09,670 [ERROR]  @managercli.py:151 - Error during registration: 'exceptions.ValueError' object has no attribute 'msg'
2014-07-24 10:22:09,670 [ERROR]  @managercli.py:152 - 'exceptions.ValueError' object has no attribute 'msg'
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1048, in _do_command
    self.options.environment)
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1134, in _get_environment_id
    env = cp.getEnvironment(owner_key=owner_key, name=environment_name)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1029, in getEnvironment
    results = self.conn.request_get(url)
  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'

Comment 4 sthirugn@redhat.com 2014-07-28 14:17:28 UTC
The error message was caused by an other bug - https://bugzilla.redhat.com/show_bug.cgi?id=1123514

Using invalid env/cv shows a valid error message:

# subscription-manager register --username='admin' --password='changeme' --org='rhcorp' --environment='a/b' --autosubscribe
No such environment: a/b


# subscription-manager register --username='admin' --password='changeme' --org='rhcorp' --environment='DEV/cv1' --autosubscribe
The system has been registered with ID: e84c386b-aa2b-47d6-a117-09fd66b37c72 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed


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