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 2005754 - Issue while registering the RHEL 6 Host using new Satellite Server Token Registration Steps.
Summary: Issue while registering the RHEL 6 Host using new Satellite Server Token Reg...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.10.0
Assignee: satellite6-bugs
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-20 04:47 UTC by Surjeet Salvi
Modified: 2024-12-20 21:07 UTC (History)
3 users (show)

Fixed In Version: foreman-2.5.2.13-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:13:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 33408 0 Normal Closed Add support for all RHEL derivatives in Content Host Registration 2021-09-20 06:30:10 UTC
Github theforeman foreman pull 8774/files 0 None None None 2021-09-20 06:30:10 UTC
Red Hat Knowledge Base (Solution) 6344741 0 None None None 2021-09-21 03:06:33 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:13:58 UTC

Description Surjeet Salvi 2021-09-20 04:47:22 UTC
DESCRIPTION OF PROBLEM:
- Unable to register the RHEL 6 host using new Satellite Server Token Registration Steps

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

HOW TO REPRODUCE:

- Create Token from Satellite WEBUI and try to register
# curl --insecure -X GET "https://satellite.example.com:9090/register?activation_key=test&hostgroup_id=2&location_id=2&operatingsystem_id=6&organization_id=1&setup_insights=false&setup_remote_execution=false" -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MzIwOTk5NTIsImp0aSI6IjVkODFkZjc2NTcxYjEzNjgyY2QzMTk3MzhlNzljMTljMzY2NWNiZWU3YTg2OTAxOTAzODFkYjRjMTZmYTYwZGQiLCJleHAiOjE2MzIxMTQzNTJ9.XBICWN-Ut3Yc6n3AoGCBizeX2791kh8isqxZSiCc43Y' | bash

ACTUAL RESULT:

- Blank host profile is getting created on Red Hat Satellite WEBUI. 
- Host is not getting registered in actual

EXPECTED RESULT:

- Host should get register with the Red Hat Satellite server. 


ADDITIONAL INFORMATION:

- After reviewing the background script it is looking for file /etc/os-release and pulling the ID from it

+++++++
if ! [ $(id -u) = 0 ]; then
    echo "Please run as root"
    exit 1
fi

if [ -f /etc/os-release ] ; then
  . /etc/os-release
fi


if [ x$ID = xrhel ] || [ x$ID = xcentos ]; then
    register_katello_host(){
        UUID=$(subscription-manager identity | head -1 | awk '{print $3}')
        curl --cacert $SSL_CA_CERT --request POST "https://susalvi-rhsat.syslab.pnq2.redhat.com:9090/register" \
             --data "uuid=$UUID" \
            -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MzIxMDY3OTksImp0aSI6ImU3NTI2N2U1OGU4OGVkZjc4ZTViNzdjODcyNThiNjk3MGY4ZGQ2N2RhNmQxZjExNjM4ZTk5Y2ZmYzdhNjIxNmEiLCJleHAiOjE2MzIxMjExOTl9.kqpnGBJBFarmR6WBAQVrGdpGTg59jGA0tR3LsnR6V0U' \
            --data "host[organization_id]=1"            --data "host[location_id]=2"            --data "host[hostgroup_id]=2"            --data "setup_insights=false"            --data "setup_remote_execution=false"            
    }

    CONSUMER_RPM=$(mktemp --suffix .rpm)
    curl --output $CONSUMER_RPM http://susalvi-rhsat.syslab.pnq2.redhat.com/pub/katello-ca-consumer-latest.noarch.rpm
    yum localinstall $CONSUMER_RPM -y
    rm -f $CONSUMER_RPM

    subscription-manager register --org='RedHat' --activationkey='test' || exit 1
    register_katello_host | bash
else
    register_host | bash


- Since the/etc/os-release file is not present on the RHEL 6 host, it is only creating the blank host profile and skipping the actual registration part.


WORKAROUND - 
 
- Manually create the file "/etc/os-release" with the below details. 

++++++++
NAME="Red Hat Enterprise Linux Server"
VERSION="6.10 (Santiago)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="6.10"
++++++++

- Now execute the below curl command and it will register the host successfully.

# curl --insecure -X GET "https://satellite.example.com:9090/register?activation_key=test&hostgroup_id=2&location_id=2&operatingsystem_id=6&organization_id=1&setup_insights=false&setup_remote_execution=false" -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MzIwOTk5NTIsImp0aSI6IjVkODFkZjc2NTcxYjEzNjgyY2QzMTk3MzhlNzljMTljMzY2NWNiZWU3YTg2OTAxOTAzODFkYjRjMTZmYTYwZGQiLCJleHAiOjE2MzIxMTQzNTJ9.XBICWN-Ut3Yc6n3AoGCBizeX2791kh8isqxZSiCc43Y' | bash

Comment 1 Leos Stejskal 2021-09-20 06:30:11 UTC
Hi,
this is expected behavior, we rely on /etc/os-release file,
for systems that doesn't have this file we register machine with minimal data.

Anyway this issue should be fixed in https://github.com/theforeman/foreman/pull/8774,
where we use `/etc/redhat-release` instead of `/etc/os-release`.

Comment 8 errata-xmlrpc 2021-11-16 14:13:51 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 (Moderate: Satellite 6.10 Release), 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://access.redhat.com/errata/RHSA-2021:4702


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