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 1683835 - Upgrading from one katello-ca-consumer version to another breaks rhsm.conf
Summary: Upgrading from one katello-ca-consumer version to another breaks rhsm.conf
Keywords:
Status: CLOSED DUPLICATE of bug 1619533
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: 6.8.0
Assignee: satellite6-bugs
QA Contact: Devendra Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-27 23:20 UTC by Gary Scarborough
Modified: 2024-06-13 22:03 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-28 13:35:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Gary Scarborough 2019-02-27 23:20:52 UTC
Description of problem:
The default rhsm.conf file points to redhat.com and has a prefix of /subscription.  Installing a katello-ca-consumer file changes that file to point to the satellite and have a prefix of /rhsm.  If you use rpm -Uvh to install a new katello-ca-consumer file such as changing your certs, the rhsm.conf file ends up pointing to redhat.com and having a subscription of /subscription.  

Removing the katello file and doing a straight install works as expected.  Only the upgrade seems to be broken.  

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

Sat 6.4 but probably an issue in 6.3 as well.

How reproducible:

Always

Steps to Reproduce:
1. INstall older katello-ca-consumer file on host.

2. Use rpm -Uvh to install a new one.

3. Examine rhsm.conf and see it point to redhat.com instead of satellite.

Actual results:

rhsm.conf file is corrupted.

Expected results:

rhsm.conf pointing to satellite with the correct prefix.


Additional info:

Comment 3 Vincent S. Cojot 2019-03-13 20:55:45 UTC
Looking at the src.rpm's SPEC file that Mathieu uploaded, I think the following section:
======================= CUT HERE =======================
%post
/bin/bash /usr/bin/katello-rhsm-consumer

%postun
test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf
======================= CUT HERE =======================

should be changed to something like this:
======================= CUT HERE =======================
%post
if [ "$1" = "1" ]; then
# this is an initial install, not an upgrade.
/bin/bash /usr/bin/katello-rhsm-consumer
fi

%postun
if [ $1 -eq 0 ]; then
# this is an uninstall, not an upgrade.
test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf
fi
======================= CUT HERE =======================

Comment 4 Vincent S. Cojot 2019-03-13 20:57:40 UTC
I did rebuild both rpms and made two versions with the SPEC file changes.

[root@rh7x64 noarch]# rpm -ivh katello-ca-consumer-w0575.example.com-1.0-170.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-w0575stipsnms################################# [100%]
[root@rh7x64 noarch]# grep prefix /etc/rhsm/rhsm.conf
# Server prefix:
prefix = /rhsm

[root@rh7x64 noarch]# rpm -Uvh katello-ca-consumer-w0575.example.com-1.0-180.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-w0575stipsnms################################# [ 50%]
Cleaning up / removing...
   2:katello-ca-consumer-w0575stipsnms################################# [100%]

[root@rh7x64 noarch]# grep prefix /etc/rhsm/rhsm.conf
# Server prefix:
prefix = /rhsm

Comment 5 Vincent S. Cojot 2019-03-14 13:56:58 UTC
Btw, i am not even sure the %post should be skipped in the case of an upgrade.
The %postun makes sense but if the satellite script called in %post (/usr/bin/katello-rhsm-consumer) truly is idempotent then perhaps it shouldn't be skipped when in an upgrade.
I've not read /usr/bin/katello-rhsm-consumer so I cannot tell if it will be future-proof and sufficient to skip it (what happens if Satellite gets upgraded from 6.4 to 6.5, does that script need to be re-evaluated?)


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