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 2049304 - katello-rhsm-consumer script subscription-manager version detection depends on subscription-manager rpm being installed
Summary: katello-rhsm-consumer script subscription-manager version detection depends o...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Omkar Khatavkar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-01 21:35 UTC by Martin Kolman
Modified: 2023-09-15 01:51 UTC (History)
6 users (show)

Fixed In Version: puppet-foreman_proxy_content-20.2.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:32:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34406 0 Normal New katello-rhsm-consumer script subscription-manager version detection depends on subscription-manager rpm being installed 2022-02-07 15:20:44 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:33:00 UTC

Description Martin Kolman 2022-02-01 21:35:46 UTC
Description of problem:
The subman version detection code in the katello-rhsm-consumer script depends on the subscription-manager being installed from an RPM and an RPM database actually being available.

Code in questions:


# configure rhsm
  # the config command was introduced in rhsm 0.96.6
  # fallback left for older versions
  if test ${RHSM_VERSION[0]:-0} -gt 0 -o ${RHSM_VERSION[1]:-0} -gt 96 -o \( ${RHSM_VERSION[1]:-0} -eq 96 -a ${RHSM_VERSION[2]:-0} -gt 6 \); then
    subscription-manager config \
      --server.hostname="$KATELLO_SERVER" \
      --server.prefix="$PREFIX" \
      --server.port="$PORT" \
      --rhsm.repo_ca_cert="%(ca_cert_dir)s$KATELLO_SERVER_CA_CERT" \
      --rhsm.baseurl="$BASEURL"

    # Older versions of subscription manager may not recognize
    # report_package_profile and package_profile_on_trans options.
    # So set them separately and redirect out & error to /dev/null
    # to fail silently.
    subscription-manager config --rhsm.package_profile_on_trans=1 > /dev/null 2>&1 || true
    subscription-manager config --rhsm.report_package_profile=1 > /dev/null 2>&1 || true
  else
    sed -i "s/^hostname\s*=.*/hostname = $KATELLO_SERVER/g" $CFG
    sed -i "s/^port\s*=.*/port = $PORT/g" $CFG
    sed -i "s|^prefix\s*=.*|prefix = $PREFIX|g" $CFG
    sed -i "s|^repo_ca_cert\s*=.*|repo_ca_cert = %(ca_cert_dir)s$KATELLO_SERVER_CA_CERT|g" $CFG
    sed -i "s|^baseurl\s*=.*|baseurl=$BASEURL|g" $CFG
  fi


This might not always work, for example if the given system is not RPM based or possibly is a minimal immutable system without a RPM database present.

Parsing the versions out of the subscription-manager command output should be more robust.


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


How reproducible:
always

Steps to Reproduce:
1. boot into a system that has subscription-manager command present but subscription-manager RPM is nor marked as installed (for example any RHEL 9 installation boot.iso)
2. download and run the Satellite bootstrap script

Actual results:
Version detection fails and the bootsrap script will enter the sub-optimal fallback branch.

Expected results:
Version detection works even if subscription-manager RPM is no marked as installed, fallback branch not used.

Additional info:
The RHEL 9 installation image (AKA the "boot.iso") is a minimal image that doesn't contain a local RPM database. 

(Installation image size is important as it directly drives customer storage, RAM and data transfer requirements for RHEL installations.)

The Anaconda installer runs the Bootstrap script during a registration attempt to a Satellite instance, the version check fails due to missing RPM database and the bootstrap script falls back to the sed based rhsm.config manipulation method.
This directly triggers RHSM bug 2049296 and requires Anaconda side workaround to still work correctly.

Comment 2 Evgeni Golov 2022-02-07 13:16:40 UTC
Hi Martin,

is there a way to get the sub-man version in machine readable way? parsing the (rather verbose) output of "subscription-manager version" doesn't sound robust at all to me.

Comment 4 Evgeni Golov 2022-02-07 15:20:43 UTC
Created redmine issue https://projects.theforeman.org/issues/34406 from this bug

Comment 8 errata-xmlrpc 2022-07-05 14:32:43 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.11 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-2022:5498

Comment 9 Red Hat Bugzilla 2023-09-15 01:51:32 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days


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