Bug 1309553

Summary: Failed to register with consumer id against SAM1.4
Product: Red Hat Enterprise Linux 6 Reporter: qianzhan
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: high    
Version: 6.8CC: bcourt, cfouant, csnyder, gxing, qianzhan, sgao
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-10 20:40:41 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:
Attachments:
Description Flags
katello-debug-20160218213327.tar.gz
none
rhsm.log none

Description qianzhan 2016-02-18 05:53:41 UTC
Description of problem:
Failed to register with consumer id against SAM1.4

Version-Release number of selected component (if applicable):
subscription-manager: 1.16.8-2.el6
python-rhsm: 1.16.6-1.el6


How reproducible:
Always

Steps to Reproduce:
1. Register system against SAM1.4.
[root@dhcp-129-73 ~]# subscription-manager identity
system identity: eb31655a-afa2-4613-bc2f-a3cdd4fba44f
name: dhcp-129-73.nay.redhat.com
org name: ACME_Corporation
org ID: ACME_Corporation


2. Clean consumer certs
[root@dhcp-129-73 ~]# rm -f /etc/pki/consumer/*

3. Re-register with consumer id:
[root@dhcp-129-73 ~]# subscription-manager register --consumerid=eb31655a-afa2-4613-bc2f-a3cdd4fba44f
Registering to: samserv.redhat.com:443/sam/api
Username: admin
Password: 
'type'

4. Re-register without consumer id:
[root@dhcp-129-73 ~]# subscription-manager register
Registering to: samserv.redhat.com:443/sam/api
Username: admin
Password: 
The system has been registered with ID: 55382f25-51b6-4902-a6dd-2406923f1f66 


Actual results:
As step 3.

Expected results:
Registration with consumer id should be successful.

Additional info:

Comment 2 Barnaby Court 2016-02-18 20:55:56 UTC
Please attach the candlepin log file while this error occurred.

Comment 3 qianzhan 2016-02-19 02:48:06 UTC
Please see katello-debug info from SAM server: katello-debug-20160218213327.tar.gz

And the rhsm.log from client: rhsm.log

Comment 4 qianzhan 2016-02-19 02:48:46 UTC
Created attachment 1128401 [details]
katello-debug-20160218213327.tar.gz

Comment 5 qianzhan 2016-02-19 02:49:36 UTC
Created attachment 1128402 [details]
rhsm.log

Comment 6 Barnaby Court 2016-02-22 18:20:24 UTC
The relevant log entries from rhsm.log:

2016-02-18 19:36:46,614 [DEBUG] subscription-manager:32054 @connection.py:557 - Making request: GET /sam/api/consumers/3faa59c5-3bef-4fd0-ad34-1aaaff55fe06
2016-02-18 19:36:46,828 [DEBUG] subscription-manager:32054 @connection.py:589 - Response: status=200
2016-02-18 19:36:46,829 [WARNING] subscription-manager:32054 @connection.py:593 - Clock skew detected, please check your system time
2016-02-18 19:36:46,835 [ERROR] subscription-manager:32054 @managercli.py:174 - Error during registration: 'type'
2016-02-18 19:36:46,835 [ERROR] subscription-manager:32054 @managercli.py:175 - 'type'
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 1084, in _do_command
    if consumer['type']['manifest']:
KeyError: 'type'

Comment 9 Chris Snyder 2016-02-25 22:41:39 UTC
Upon further investigation it appears that Sam 1.4 is not returning the consumer type as part of the json returned from calls to /sam/api/consumers/<consumerid>.

The PR above will allow the command to succeed even in the case the json does not include the type but that is not desirable as it would allow users of the latest subman to register as distributors (reintroducing a bug that was previously fixed).

It appears that the version of candlepin included with sam 1.4 has the necessary information as part of its model.

Christine, is there any way that sam could be filtering out the consumer type for some reason?

Comment 10 Chris Snyder 2016-03-05 07:00:48 UTC
Vritant and I have accepted the suggested fix for the time being after talking with Christine. I no longer require additional information from her for this issue.

Comment 13 qianzhan 2016-03-07 10:05:46 UTC
I will verify it when next RHEL6.8 build comes.

Comment 14 John Sefler 2016-03-08 19:20:49 UTC
(In reply to qianzhan from comment #13)
> I will verify it when next RHEL6.8 build comes.

Thank you qianzhan for verifying...  It is now available in build...

[root@jsefler-6 ~]# rpm -q subscription-manager
subscription-manager-1.16.8-4.el6.x86_64
[root@jsefler-6 ~]# rpm -q subscription-manager --changelog | grep 1309553
- 1309553: Do not fail on check for consumer["type"]["manifest"]

Comment 15 qianzhan 2016-03-09 03:27:29 UTC
Thanks for John's reminder.

I installed RHEL-6.8-20160308.0, and it's subscription version:

[root@dhcp-128-75 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 1.4.3.28-1.el6sam_splice-Headpin
subscription management rules: Unknown
subscription-manager: 1.16.8-3.el6
python-rhsm: 1.16.6-1.el6

Failed in build RHEL-6.8-20160308.0:
[root@dhcp-128-75 ~]# subscription-manager register --consumerid=eb799120-448c-4350-b0ea-27c7f0ea5162
Registering to: samserv.redhat.com:443/sam/api
Username: admin
Password: 
'type'

So still need to wait for next new build.

Comment 16 John Sefler 2016-03-09 13:52:15 UTC
My apologies to qianzhan.  The fixed package is in the nightly compose RHEL-6.8-20160308.n.0 but it is NOT in the rel-eng compose RHEL-6.8-20160308.0.  I agree that we should wait for verification in a rel-eng compose.  Thanks.

Comment 17 qianzhan 2016-03-17 03:17:40 UTC
Verified.

Version-Release number of selected component:
subscription-manager: 1.16.8-5.el6
python-rhsm: 1.16.6-1.el6

Verification:
[root@dhcp-128-48 ~]# subscription-manager register
Registering to: samserv.redhat.com:443/sam/api
Username: admin
Password: 
The system has been registered with ID: 19edb3d4-cffb-4a63-8eb4-df8858899af6 
[root@dhcp-128-48 ~]# rm -f /etc/pki/consumer/*
[root@dhcp-128-48 ~]# subscription-manager register --consumerid=19edb3d4-cffb-4a63-8eb4-df8858899af6
Registering to: samserv.redhat.com:443/sam/api
Username: admin
Password: 
The system has been registered with ID: 19edb3d4-cffb-4a63-8eb4-df8858899af6 


Moving this bug from ON_QA to VERIFIED.

Comment 19 errata-xmlrpc 2016-05-10 20:40:41 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-2016-0797.html