Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1122991

Summary: trying to register using a non-existent environment/cv returns cryptic error in subscription-manager
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: RegistrationAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED NOTABUG QA Contact: sthirugn <sthirugn>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: sthirugn
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-28 14:17:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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