aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2019-03-28 16:19:58 +0800
committeryangyan <yangyanyj@chinamobile.com>2019-03-28 16:20:06 +0800
commit851b225664d343dafe271e2de2ca255d959460d7 (patch)
tree989ee76fafc7e4e3c62a57ddbdd14fadbdbe38ce /docker
parent99883e3fc3928113047255783b0979f856bb723a (diff)
fix the bug of catalog
Change-Id: Id9fd2683cb5712dcd6f196af6deb50dc9345ec54 Issue-ID: VFC-1319 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/instance_init.sh26
1 files changed, 6 insertions, 20 deletions
diff --git a/docker/instance_init.sh b/docker/instance_init.sh
index 6e51cc17..534be75a 100755
--- a/docker/instance_init.sh
+++ b/docker/instance_init.sh
@@ -1,11 +1,5 @@
#!/bin/bash
-######
-# by vfc-db test
-#####
-# echo "No service needs init."
-#MYSQL_USER=$1
-######
-#by duan
+
pip install PyMySQL==0.9.3
if [ ! -f /var/log/onap/vfc/catalog/runtime_catalog.log ]; then
mkdir -p /var/log/onap/vfc/catalog
@@ -29,22 +23,14 @@ MYSQL_ROOT_PASSWORD=`echo $MYSQL_AUTH | cut -d: -f 2`
function create_database {
cd /service/vfc/nfvo/catalog/resources/bin
bash initDB.sh $MYSQL_USER $MYSQL_ROOT_PASSWORD $MYSQL_PORT $MYSQL_IP
- #DIRNAME=`dirname $0`
- #HOME=`cd $DIRNAME/; pwd`
- #man_path=$HOME/../
+
man_path=/service/vfc/nfvo/catalog
- #tab=`mysql -u${MYSQL_USER} -p${MYSQL_PASSWORD} -P${MYSQL_PORT} -h${MYSQL_IP} -e "use vfcnfvolcm; select count(*) from vfcnfvolcm;"`
+
tab=`mysql -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -P${MYSQL_PORT} -h${MYSQL_IP} -e "SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='nfvocatalog';"`
tab1=`echo $tab |awk '{print $2}'`
- echo "=========="
- echo $tab1
- echo "=========="
- if [ $tab1 -eq 0 ] ; then
- echo "============"
- echo $tab1
- echo "============"
+
echo "TABLE NOT EXISTS, START MIGRATE"
- python $man_path/manage.py makemigrations database && python $man_path/manage.py migrate &
+ python $man_path/manage.py makemigrations database && python $man_path/manage.py migrate database &
wait
tab2=`mysql -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -P${MYSQL_PORT} -h${MYSQL_IP} -e "SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='nfvocatalog';"`
tab3=`echo $tab2|awk '{print $2}'`
@@ -59,7 +45,7 @@ fi
if [ ! -f /service/vfc/nfvo/catalog/docker/db.txt ]; then
echo 1 > /service/vfc/nfvo/catalog/docker/db.txt
- echo `pwd` >> /service/vfc/nfvo/catalog/docker/db.txt
+
create_database
else
echo "database already existed"