Project

General

Profile

Bug #34406

katello-rhsm-consumer script subscription-manager version detection depends on subscription-manager rpm being installed

Added by Evgeni Golov 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2049304

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:

  1. configure rhsm # the config command was introduced in rhsm 0.96.6 # fallback left for older versions
    if test ${RHSM_VERSION0:-0} -gt 0 -o ${RHSM_VERSION1:-0} -gt 96 -o \( ${RHSM_VERSION1:-0} -eq 96 -a ${RHSM_VERSION2:-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"
    1. Older versions of subscription manager may not recognize
    2. report_package_profile and package_profile_on_trans options.
    3. So set them separately and redirect out & error to /dev/null
    4. 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.

Associated revisions

Revision 57dabd51 (diff)
Added by Evgeni Golov 3 months ago

Fixes #34406 - drop support for ancient EL versions

we don't need to support EL5 at all anymore, and EL6 has the fixed
sub-man sice 6.2, which is totally good enough

History

#1 Updated by The Foreman Bot 3 months ago

  • Assignee set to Evgeni Golov
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/puppet-foreman_proxy_content/pull/400 added

#2 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 3.2.0 added

#3 Updated by Evgeni Golov 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF