Bug 1386140

Summary: spacewalk-hostname-rename does not work on 5.8.0 with embedded PostgreSQL 9.5
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Radovan Drazny <rdrazny>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: galtukho, rdrazny, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-web-2.5.2-7-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 12:18:58 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:
Bug Depends On:    
Bug Blocks: 1340444    

Description Jan Hutař 2016-10-18 09:30:59 UTC
Description of problem:
spacewalk-hostname-rename does not work on 5.8.0 compose with embedded PostgreSQL 9.5


Version-Release number of selected component (if applicable):
spacewalk-utils-2.5.1-7.el6sat.noarch
rh-postgresql95-postgresql-server-9.5.4-2.el6.x86_64


How reproducible:
always


Steps to Reproduce:
1. Attempt to use spacewalk-hostname-rename


Actual results:
# spacewalk-hostname-rename 192.168.10.100
Validating IP ... OK
=============================================
hostname: satellite.example.com
ip: 192.168.10.100
=============================================
Stopping rhn-satellite services ... OK
Testing DB connection ... FAILED
Your database isn't running.
Fix the problem and run /usr/bin/spacewalk-hostname-rename again


Expected results:
Should work.


Additional info:
This fixed it for me:

# diff -u /usr/bin/spacewalk-hostname-rename{.ORIG,}
--- /usr/bin/spacewalk-hostname-rename.ORIG	2016-10-18 05:25:09.976366571 -0400
+++ /usr/bin/spacewalk-hostname-rename	2016-10-18 05:27:43.728366510 -0400
@@ -49,8 +49,8 @@
     if [ -x /etc/init.d/postgresql -o -f /usr/lib/systemd/system/postgresql.service ]; then
         DB_SERVICE="postgresql"
     fi
-    if [ -x /etc/init.d/postgresql92-postgresql ]; then
-        DB_SERVICE="postgresql92-postgresql"
+    if [ -x /etc/init.d/rh-postgresql95-postgresql ]; then
+        DB_SERVICE="rh-postgresql95-postgresql"
     fi
 fi

Comment 3 Radovan Drazny 2017-01-18 10:44:08 UTC
Verified on spacewalk-utils-2.5.1-10. 

# spacewalk-hostname-rename 10.19.41.82
Validating IP ... OK
=============================================
hostname: bkr-hv01-guest02.dsal.lab.eng.bos.redhat.com
ip: 10.19.41.82
=============================================
Stopping rhn-satellite services ... OK
Testing DB connection ... OK
Updating /etc/rhn/rhn.conf ... OK
Actual SSL key pair package: rhn-org-httpd-ssl-key-pair-bkr-hv01-guest02.dsal.lab.eng.bos-1.0-1.noarch
 No need to re-generate SSL certificate.
Regenerating new bootstrap client-config-overrides.txt ... OK
Updating other DB entries ... OK
Changing cobbler settings ... OK
Changing jabberd settings ... OK
Starting rhn-satellite services ... OK

VERIFIED