Bug 1371585

Summary: Removing katello-ca-consumer rpm should revert rhsm.conf
Product: Red Hat Satellite Reporter: Sean O'Keeffe <sokeeffe>
Component: katello-agentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, bkearney, egolov, jcallaha, nkathole, swadeley
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When removing katello-ca-consumer RPM, the backup of /etc/rhsm/rhsm.conf was not restored. This is now fixed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 12:57:01 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 Sean O'Keeffe 2016-08-30 14:36:13 UTC
Description of problem:
if you install the katello-ca-consumer rpm and them remove it /etc/rhsm/rhsm.conf, doesnt revert back. 
During install there is a backup created /etc/rhsm/rhsm.conf-kat-backup, we should copy this file to /etc/rhsm/rhsm.conf on removal.


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

How reproducible:
100%

Steps to Reproduce:
1. ms5sum /etc/rhsm/rhsm.conf 
2. rpm -Uvh http://<SATELLITE6>/pub/katello-ca-consumer-latest.noarch.rpm
3. rpm -e katello-ca-consumer
4. ms5sum /etc/rhsm/rhsm.conf

md5sum's should match. 

Actual results:
the rhsm.conf pointing to Satellite is left after removing it

Expected results:
rhsm.conf should be restored from rhsm.conf-kat-backup

Additional info:

Comment 2 Bryan Kearney 2016-09-07 20:18:33 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16388 has been resolved.

Comment 5 Evgeni Golov 2017-08-23 09:04:37 UTC
I am not QA contact, so I am not going to officially mark this as VERIFIED, but it works as advertised in my setup (6.3.0 Snap 12):

Make a copy of the old rhsm.conf:
# cp /etc/rhsm/rhsm.conf ./rhsm.conf.orig

Install katello-ca-consumer:
# yum localinstall http://192.168.121.147/pub/katello-ca-consumer-latest.noarch.rpm

Make a copy of the modified rhsm.conf:
# cp /etc/rhsm/rhsm.conf ./rhsm.conf.katello

Remove katello-ca-consumer:
# yum erase katello-ca-consumer\*

Make a copy of the restored rhsm.conf
# cp /etc/rhsm/rhsm.conf ./rhsm.conf.new

Verify that only the modified version has a different checksum:
# md5sum rhsm.conf.*
ea0b3593f3d504b16a266d58b0f83c85  rhsm.conf.katello
625497ba8aaa66608a79c4eefd81ff09  rhsm.conf.new
625497ba8aaa66608a79c4eefd81ff09  rhsm.conf.orig

Comment 6 Nikhil Kathole 2017-12-21 09:54:24 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 29

steps:
# md5sum /etc/rhsm/rhsm.conf
f8f5f059d09476660fab36d8b0d65367  /etc/rhsm/rhsm.conf

# rpm -Uvh http://satellite/pub/katello-ca-consumer-latest.noarch.rpm
Retrieving http://satellite/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-sat.################################# [100%]

# md5sum /etc/rhsm/rhsm.conf
f8b0bc5db94930e869535d146b9d2b15  /etc/rhsm/rhsm.conf

# yum erase katello-ca-consume\*
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package katello-ca-consumer-satellite.noarch 0:1.0-1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================
 Package                                                                 Arch                  Version              Repository                Size
===================================================================================================================================================
Removing:
 katello-ca-consumer-satellite                noarch                1.0-1                installed                 15 k

Transaction Summary
===================================================================================================================================================
Remove  1 Package

Installed size: 15 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Erasing    : katello-ca-consumer-satellite-1.0-1.noarch                                                           1/1
  Verifying  : katello-ca-consumer-satellite-1.0-1.noarch                                                           1/1

Removed:
  katello-ca-consumer-satellite.noarch 0:1.0-1

Complete!

# md5sum /etc/rhsm/rhsm.conf
f8f5f059d09476660fab36d8b0d65367  /etc/rhsm/rhsm.conf

Comment 9 errata-xmlrpc 2018-02-21 12:57:01 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/RHBA-2018:0338