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:
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 =======================
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
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?)