Bug 1619533

Summary: Upgrade katello-ca-consumer rpm will cause rhsm.conf to point back to customer portal.
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: RegistrationAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Stephen Wadeley <swadeley>
Severity: medium Docs Contact:
Priority: high    
Version: 6.5.0CC: achadha, arusso, brian.mccafferty, chrobert, ehelms, fperalta, gscarbor, jhanley, jobuckle, jsherril, jyejare, ktordeur, mike, mvanderw, pcreech, pdwyer, rbertolj, rbobek, rcavalca, sadas, smajumda, supatil, susalvi, swadeley
Target Milestone: 6.7.0Keywords: Regression, Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-installer-1.24.1.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1791503 (view as bug list) Environment:
Last Closed: 2020-04-14 13:23:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hao Chang Yu 2018-08-21 06:56:12 UTC
Description of problem:
I think this is the regression of Bug #1371585.

%postun will be triggered on upgrade and cause the rhsm.conf to restore back to default.

...
%postun
test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf   <========= move the backup rhsm.conf back
...


# rpm -Uvh katello-ca-consumer-lonlx80022.nomura.com-1.0-8.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-lonlx80022.no################################# [ 50%]
Cleaning up / removing...
   2:katello-ca-consumer-lonlx80022.no################################# [100%]  <=========== %postun will be triggered here

% egrep -i 'host|server' /etc/rhsm/rhsm.conf | egrep -v '^#'
[server]
hostname = subscription.rhsm.redhat.com

Comment 2 Andrew Kofink 2018-12-13 22:07:14 UTC
Created redmine issue https://projects.theforeman.org/issues/25683 from this bug

Comment 3 Michael Cronenworth 2019-06-04 00:25:27 UTC
Still present in Satellite 6.5. :(

Comment 5 Roman Bobek 2019-11-07 08:49:52 UTC
*** Bug 1704984 has been marked as a duplicate of this bug. ***

Comment 6 Rudnei Bertol Jr. 2019-12-17 13:18:11 UTC
Hey Team,

Any update? 

Is there any patch/hotfix or workaround?

regards
rbertol

Comment 7 Aaron Russo 2019-12-17 17:59:02 UTC
This is the updated postun scriptlet I proposed in my support case w/RH to get this fixed -- essentially it's only reverting if it's an actual removal and not during an upgrade situation:

```
%postun
if [ $1 -eq 0 ]; then
  test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf
fi
```

I didn't try to rebuild myself so I haven't verified this to work, but it seems like it should.

If you want to avoid re-building the package you could try setting the file immutable or better yet setup a yum post-transaction action to run /usr/bin/katello-rhsm-consumer to reconfigure the file whenever that package is updated.

Comment 8 Bryan Kearney 2020-01-03 17:04:56 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25683 has been resolved.

Comment 10 Brad Buckingham 2020-01-28 13:35:42 UTC
*** Bug 1683835 has been marked as a duplicate of this bug. ***

Comment 15 errata-xmlrpc 2020-04-14 13:23:24 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, 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-2020:1454