aboutsummaryrefslogtreecommitdiffstats
path: root/postgresql-prep
diff options
context:
space:
mode:
Diffstat (limited to 'postgresql-prep')
-rwxr-xr-xpostgresql-prep/src/common/postinst20
-rwxr-xr-xpostgresql-prep/src/stage/opt/app/postgresql-prep/bin/iDNS-responder.py9
2 files changed, 19 insertions, 10 deletions
diff --git a/postgresql-prep/src/common/postinst b/postgresql-prep/src/common/postinst
index bad825b..6f0218e 100755
--- a/postgresql-prep/src/common/postinst
+++ b/postgresql-prep/src/common/postinst
@@ -56,7 +56,7 @@ case "$CONFCOUNT" in
# PG_NODES : uiopmno1qwpstg00.research.example.com|asbczw1vepstg00.dcae.simpledemo.openecomp.org
# PG_JAVA_HOME : /opt/app/java/jdk/jdk170
# PG_CLUSTER : global
- sed -e 's/ *: */="/' -e 's/[ ]*$/"/' -e 's/=""/="/' -e 's/""$/"/' < /tmp/postgres.conf > $TMP
+ cat $CONFDIR/*-postgres.conf | sed -e 's/ *: */="/' -e 's/[ ]*$/"/' -e 's/=""/="/' -e 's/""$/"/' > $TMP
. $TMP
;;
0 ) ;;
@@ -84,11 +84,17 @@ chmod 700 ${INSTALL_ROOT}/dbroot/pgdata/main
if $OPENECOMP
then
- mv /var/lib/postgresql/9.5/main /var/lib/postgresql/9.5/main.sv
- ln -s /dbroot/dbdata/main /var/lib/postgresql/9.5/main
-
- mv /etc/postgresql/9.5/main /etc/postgresql/9.5/main.sv
- ln -s /opt/app/postgresql-config/main /etc/postgresql/9.5/main
+ if [ -d /var/lib/postgresql/9.5 ]
+ then VER=9.5
+ elif [ -d /var/lib/postgresql/9.6 ]
+ then VER=9.6
+ else die "Cannot determine version of PostgreSQL. Looking for /var/lib/postgresql/9.[56]."
+ fi
+ mv /var/lib/postgresql/$VER/main /var/lib/postgresql/$VER/main.sv
+ ln -s /dbroot/dbdata/main /var/lib/postgresql/$VER/main
+
+ mv /etc/postgresql/$VER/main /etc/postgresql/$VER/main.sv
+ ln -s /opt/app/postgresql-config/main /etc/postgresql/$VER/main
fi
@@ -135,7 +141,7 @@ fi
INIT=${INSTALL_ROOT}/opt/app/postgresql-prep/init
-if $OPENECOMP
+if [ -d /lib/systemd/system -a -f /bin/systemctl ]
then
su postgres -c "crontab $INIT/pglogs.cron"
diff --git a/postgresql-prep/src/stage/opt/app/postgresql-prep/bin/iDNS-responder.py b/postgresql-prep/src/stage/opt/app/postgresql-prep/bin/iDNS-responder.py
index 14c16b3..baaeb8b 100755
--- a/postgresql-prep/src/stage/opt/app/postgresql-prep/bin/iDNS-responder.py
+++ b/postgresql-prep/src/stage/opt/app/postgresql-prep/bin/iDNS-responder.py
@@ -258,12 +258,15 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
Then call ps -fu postgres and make sure we're not waiting on a master:
postgres 20815 20812 0 15:52 ? 00:00:00 postgres: startup process waiting for 000000010000000000000001
"""
- PGCTLPATH1 = "/usr/lib/postgresql/9.5/bin/pg_ctl"
- PGCTLPATH2 = "/opt/app/postgresql-9.5.2/bin/pg_ctl"
+ PGCTLPATH1 = "/usr/lib/postgresql/9.6/bin/pg_ctl"
+ PGCTLPATH2 = "/usr/lib/postgresql/9.5/bin/pg_ctl"
+ PGCTLPATH3 = "/opt/app/postgresql-9.5.2/bin/pg_ctl"
if isExe(PGCTLPATH1):
statusLines = readPipe(PGCTLPATH1 + " status -D /dbroot/pgdata/main/")
- else:
+ elif isExe(PGCTLPATH2):
statusLines = readPipe(PGCTLPATH2 + " status -D /dbroot/pgdata/main/")
+ else:
+ statusLines = readPipe(PGCTLPATH3 + " status -D /dbroot/pgdata/main/")
debugTrace("isServerUp(): statusLines = %s" % statusLines)
psLines = readPipe("ps -fu postgres")
debugTrace("isServerUp(): ps -fu postgres = %s" % psLines)