Martin André 7bab87f8cc Cleanup variable checks in glance-registry/start.sh
Remove redundant checks for MARIADB_SERVICE_HOST and DB_ROOT_PASSWORD
that are performed in `check_for_db`, and add missing check for
GLANCE_DB_USER.

Change-Id: Ie8194ce76274a9356dcc0b51353873d8a632c66a
2014-12-03 13:30:13 +09:00

21 lines
497 B
Bash
Executable File

#!/bin/sh
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-glance.sh
check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD
check_for_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${GLANCE_DB_NAME}.* TO
'${GLANCE_DB_USER}'@'%' IDENTIFIED BY '${GLANCE_DB_PASSWORD}'
EOF
/usr/bin/glance-manage db_sync
exec /usr/bin/glance-registry