aboutsummaryrefslogtreecommitdiffstats
path: root/postgresql-prep/src/common/postinst
diff options
context:
space:
mode:
authorTony Hansen <TonyLHansen@gerrit.onap.com>2017-05-05 15:08:05 +0000
committerTony Hansen <tony@att.com>2017-05-05 21:57:32 +0000
commit48feaffcb16e1fd5eb3ce453b99797de1bd15d7a (patch)
tree54f60886e301fe999cff8a33a58bef1c0bf9fb4d /postgresql-prep/src/common/postinst
parenta936f09820b61df6d27c0d788c3b185597d1470c (diff)
rebase DCAE Storage Components from OpenECOMP
[145075] Build 1707 DCAE Storage Components from OpenECOMP source Change-Id: Ie395395ad59afb658b46ecda31a079c050e2dd2e Signed-off-by: Tony Hansen <th1395@att.com> Signed-off-by: Tony Hansen <tony@att.com>
Diffstat (limited to 'postgresql-prep/src/common/postinst')
-rwxr-xr-xpostgresql-prep/src/common/postinst23
1 files changed, 17 insertions, 6 deletions
diff --git a/postgresql-prep/src/common/postinst b/postgresql-prep/src/common/postinst
index 63a76f2..bad825b 100755
--- a/postgresql-prep/src/common/postinst
+++ b/postgresql-prep/src/common/postinst
@@ -37,23 +37,32 @@ id
umask 022
TMP=$( mktemp /tmp/pgprep.$$.XXXXXXXXXX )
-#### TODO remove comment trap 'rm -f $TMP' 0 1 2 3 15
+trap 'rm -f $TMP' 0 1 2 3 15
if $OPENECOMP
then INSTALL_ROOT=
fi
-if [ -f /tmp/postgres.conf ]
-then
+CONFDIR=/var/config/DCAE/chef
+CONFCOUNT=$(ls $CONFDIR/*-postgres.conf 2>/dev/null | wc -l)
+case "$CONFCOUNT" in
+1 )
+ # master: masternode
+ # master2: secondmasternode
+ # in DCAE, these values could be in postgres.conf or already in the environment
# DRTR_NODE_KSTOREFILE: /opt/app/dcae-certificate/keystore.jks
# DRTR_NODE_KSTOREPASS: "No Certificate"
# DRTR_NODE_PVTKEYPASS: "No Certificate"
# 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
+ sed -e 's/ *: */="/' -e 's/[ ]*$/"/' -e 's/=""/="/' -e 's/""$/"/' < /tmp/postgres.conf > $TMP
. $TMP
-fi
+ ;;
+0 ) ;;
+* )
+ die "More than one postgres.conf was found: $(ls $CONFDIR/*-postgres.conf 2>&1)"
+esac
[ -n "$PG_NODES" ] || die "PG_NODES is not set"
[ -n "$PG_CLUSTER" ] || die "PG_CLUSTER is not set"
@@ -88,7 +97,9 @@ chown -R postgres:postgres ${INSTALL_ROOT}/dbroot ${INSTALL_ROOT}/var/run/postgr
chmod 711 ~postgres
# fix up the CDF package so that it works
-ln -sf /opt/app/cdf /opt/cdf
+if [ ! -L /opt/cdf ]
+then rm -f /opt/cdf; ln -sf /opt/app/cdf /opt/cdf
+fi
# and save some values within
(