From 48feaffcb16e1fd5eb3ce453b99797de1bd15d7a Mon Sep 17 00:00:00 2001 From: Tony Hansen Date: Fri, 5 May 2017 15:08:05 +0000 Subject: rebase DCAE Storage Components from OpenECOMP [145075] Build 1707 DCAE Storage Components from OpenECOMP source Change-Id: Ie395395ad59afb658b46ecda31a079c050e2dd2e Signed-off-by: Tony Hansen Signed-off-by: Tony Hansen --- postgresql-prep/src/common/postinst | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'postgresql-prep/src/common/postinst') 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 ( -- cgit 1.2.3-korg