summaryrefslogtreecommitdiffstats
path: root/rulemgt-standalone/src/main/assembly/bin/initDB.sh
diff options
context:
space:
mode:
authorGuangrong Fu <fu.guangrong@zte.com.cn>2017-11-04 11:40:13 +0800
committerGuangrong Fu <fu.guangrong@zte.com.cn>2017-11-04 12:02:23 +0800
commitb77188b0eb09f50f5c6470635da84d4c057c012c (patch)
treeef862fe822654ba5590b9935ee0524af0570c3e1 /rulemgt-standalone/src/main/assembly/bin/initDB.sh
parent3893b89844f0e76d1a80c578216c4320fac65ed9 (diff)
Change the DB Script to Accommodate DCAE
Change-Id: If47a0ef564cf252c461e60d4aff4021ebc24d25a Issue-ID: HOLMES-81 Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'rulemgt-standalone/src/main/assembly/bin/initDB.sh')
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/initDB.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.sh b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
index 60b1f77..b52b228 100644
--- a/rulemgt-standalone/src/main/assembly/bin/initDB.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
@@ -24,6 +24,11 @@ port=$4
host=$5
echo "start init holmes rulemgt db"
main_path=$HOME/..
+
+sed -i "s|DBNAME|$dbname|g" "$main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql"
+sed -i "s|DBUSER|$user|g" "$main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql"
+sed -i "s|DBPWD|$password|g" "$main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql"
+
cat $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql
echo "dbname=$dbname"
echo "user=$user"
@@ -31,7 +36,7 @@ echo "password=$password"
echo "port=$port"
echo "host=$host"
export PGPASSWORD=$password
-psql -U $user -p $port -h $host -f $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql
+psql -U $user -p $port -h $host -d $dbname -f $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql
psql -U $user -p $port -h $host -d $dbname --command 'select * from aplus_rule;'
sql_result=$?
unset PGPASSWORD