aboutsummaryrefslogtreecommitdiffstats
path: root/docker/instance_init.sh
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2019-04-03 11:02:53 +0800
committerYan Yang <yangyanyj@chinamobile.com>2019-04-03 03:56:54 +0000
commitbe6150278ad87a1096df914954e76b99222b9eb8 (patch)
treea6769c8944803b2f690f4a4f92dc06b9e3df997a /docker/instance_init.sh
parent35448cd519979cf0a82320180dde121a88b6eb82 (diff)
fix database bug
Change-Id: Ic96e3627b74f6be61710358777e2499f77a5c63a Issue-ID: VFC-1334 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Diffstat (limited to 'docker/instance_init.sh')
-rwxr-xr-xdocker/instance_init.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/docker/instance_init.sh b/docker/instance_init.sh
index d6ddbf60..f789a972 100755
--- a/docker/instance_init.sh
+++ b/docker/instance_init.sh
@@ -23,9 +23,9 @@ function migrate_database {
python manage.py migrate
}
-cd /service
-if [ ! -f dbexist.txt ]; then
- echo 1 > dbexist.txt
+GET_CATALOG_DB="show databases like 'nfvocatalog';"
+CATALOG_DB=`mysql -u$MYSQL_ROOT_USER -p$MYSQL_ROOT_PASSWORD -P$MYSQL_PORT -h$MYSQL_IP -e "GET_CATALOG_DB"`
+if [[ "$CATALOG_DB" == "" ]]; then
create_database
migrate_database
fi