Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1248833

Summary: subscription-manager redeem is not reporting the response to stdout
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: J.C. Molet <jmolet>
Severity: low Docs Contact:
Priority: medium    
Version: 7.2CC: alikins, bcourt, crog, csnyder, jmolet, lmiksik
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1263474 (view as bug list) Environment:
Last Closed: 2015-11-19 11:50:15 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:
Bug Depends On:    
Bug Blocks: 1263474    

Description John Sefler 2015-07-30 23:00:18 UTC
Description of problem:
After registering a system and making a call to redeem, I expect the server response to be fed back to the user.  It's not happening.

Version-Release number of selected component (if applicable):
[root@jsefler-os7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.1-1
subscription management rules: 5.15
subscription-manager: 1.15.9-2.el7
python-rhsm: 1.15.4-2.el7


How reproducible:


Steps to Reproduce:
[root@jsefler-os7 ~]# echo '{"dmi.system.serial_number":"0000000"}' > /etc/rhsm/facts/automation_override.facts
[root@jsefler-os7 ~]# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com --username=qa
Registering to: subscription.rhn.stage.redhat.com/subscription:443
Password: 
The system has been registered with ID: 42199c9d-c93a-417f-883a-9b21c6db23aa 
[root@jsefler-os7 ~]# subscription-manager redeem --email=qa
[root@jsefler-os7 ~]# 



Actual results:
no feedback

Expected results:
The system is unable to redeem the requested subscription: 0000000

Additional info:
[root@jsefler-os7 ~]# tail -f /var/log/rhsm/rhsm.log
2015-07-30 18:42:29,354 [DEBUG] subscription-manager:15948 @connection.py:500 - Making request: POST /subscription/subscriptions?consumer_uuid=42199c9d-c93a-417f-883a-9b21c6db23aa&email=qa&email_locale=en-us
2015-07-30 18:42:29,888 [DEBUG] subscription-manager:15948 @connection.py:528 - Response: status=202


^^ Notice that the POST appears successful.

Now let's use curl to see what was actually returned...

[root@jsefler-os7 ~]# curl -k -u qa:redhatqa --stderr /dev/null --request POST "https://subscription.rhn.stage.redhat.com:443/subscription/subscriptions?consumer_uuid=42199c9d-c93a-417f-883a-9b21c6db23aa&email=qa@redhat.com&email_locale=en-us" | python -m json/tool
{
    "displayMessage": "The system is unable to redeem the requested subscription: 0000000",
    "requestUuid": "d4aeb62e-af06-4073-ad4d-e97fa4b46380"
}

^^ Looks like the server is returning the correct displayMessage, but it is not being reported to the user.

Comment 2 Adrian Likins 2015-07-31 16:54:49 UTC
Looks like changes in python-rhsm that made 202 not raise an exception broke this.
Previously it expected to get a RestlibException in that case.

Comment 3 Adrian Likins 2015-07-31 16:57:03 UTC
Wonder if a 202 is really the right response in that case.

Comment 5 John Sefler 2015-08-25 19:55:20 UTC
The following failure occurs against an on-premise candlepin server...

[root@jsefler-7 ~]# subscription-manager register --username=testuser1 --password=password --org=admin --force --serverurl=jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin
The system with UUID 6ae25316-8dd9-4ccf-8630-d4f94faf2cfb has been unregistered
Registering to: jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin
The system has been registered with ID: 21cf0fbc-a3e2-4321-916d-4018df358755 
[root@jsefler-7 ~]# 
[root@jsefler-7 ~]# subscription-manager redeem --email=tester
[root@jsefler-7 ~]# 

BANG! no stdout feedback has been given.
Expected Stderr: "Standalone candlepin does not support redeeming a subscription for dmi.system.manufacturer:"



[root@jsefler-7 ~]# tail -f /var/log/rhsm/rhsm.log
2015-08-25 15:53:44,840 [DEBUG] subscription-manager:23637 @connection.py:500 - Making request: POST /candlepin/subscriptions?consumer_uuid=21cf0fbc-a3e2-4321-916d-4018df358755&email=tester&email_locale=en-us
2015-08-25 15:53:44,955 [DEBUG] subscription-manager:23637 @connection.py:528 - Response: status=204, requestUuid=d0a4b80e-75a9-4dfa-a469-fdfdb5b71ef8

Comment 6 Chris Snyder 2015-09-11 13:34:57 UTC
Should be in master as of commit: 3987d4341cf42623e57a92fdc20eed8b44f6526f


The issue was caused by a change to python-rhsm. In python-rhsm http response codes 202, and 204 were raising RestlibExceptions. They no longer do. As such subscription-manager was not checking the response for a displayMessage from candlepin.

Comment 7 Chris "Ceiu" Rog 2015-09-11 18:47:05 UTC
commit 0aff26c11d76cec1efaec7668ac11f939ed1e37b
Author: Christopher Snyder <csnyder>
Date:   Thu Sep 10 16:31:52 2015 -0400

    1248833: Ensure the displayMessage is displayed regardless of success or failure

Comment 9 J.C. Molet 2015-09-15 20:47:20 UTC
failure case in stage ( comment 1 )>>

# echo '{"dmi.system.serial_number":"0000000"}' > /etc/rhsm/facts/automation_override.facts

# subscription-manager register --serverurl=subscription.rhn.stage.redhat.com --username=qa
Registering to: subscription.rhn.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 1505d4d2-b9b4-4b9b-ae95-3db43ba6527a 

# subscription-manager redeem --email=qa
The system is unable to redeem the requested subscription: 0000000

This appears to work.

------------------

The case in comment 5 does not seem to be any different.

# subscription-manager register --username=testuser1 --password=password --org=admin --force --serverurl=jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin --insecure
Registering to: jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin
The system has been registered with ID: f35a619b-bee5-4a9f-b41b-8606d858fc0b 
[root@jmolet-vm1 ~]# subscription-manager redeem --email=tester
[root@jmolet-vm1 ~]#

Comment 10 J.C. Molet 2015-09-15 20:51:45 UTC
comment 9 is in reference to build: 

# rpm -qa | egrep "python-rhsm|subscription-manager"
subscription-manager-1.15.9-10.el7.x86_64
python-rhsm-1.15.4-5.el7.x86_64

Comment 11 John Sefler 2015-09-15 21:39:15 UTC
Let's handle the failure case from comment 5 and comment 9 against a standalone candlepin server separately under candlepin bug 1263474.

Comment 12 J.C. Molet 2015-09-15 21:45:16 UTC
Marking VERIFIED for use case in comment 1, other issues will be handled in separate bug.

Comment 13 errata-xmlrpc 2015-11-19 11:50:15 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.

https://rhn.redhat.com/errata/RHBA-2015-2122.html