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: 2022-06-23 15:21 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.