#!/bin/bash set -e if ! [ "$BARBICAN_DB_PASSWORD" ]; then BARBICAN_DB_PASSWORD=$(openssl rand -hex 15) export BARBICAN_DB_PASSWORD fi check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ KEYSTONE_ADMIN_SERVICE_PORT BARBICAN_ADMIN_PASSWORD fail_unless_db fail_unless_os_service_running keystone mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql < /dev/null 2>&1 || /bin/keystone user-create --name ${BARBICAN_KEYSTONE_USER} --pass ${BARBICAN_ADMIN_PASSWORD} keystone role-get observer > /dev/null 2>&1 || /bin/keystone role-create --name observer keystone role-get creator > /dev/null 2>&1 || /bin/keystone role-create --name creator keystone user-get ${BARBICAN_KEYSTONE_USER} > /dev/null 2>&1 || /bin/keystone user-role-add --user ${BARBICAN_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} # launch Barbican using uwsgi exec uwsgi --master --emperor /etc/barbican/vassals