diff --git a/docker/barbican/start.sh b/docker/barbican/start.sh index 676374faa0..c90f66c470 100755 --- a/docker/barbican/start.sh +++ b/docker/barbican/start.sh @@ -8,21 +8,16 @@ set -e : ${BARBICAN_KEYSTONE_USER:=barbican} : ${ADMIN_TENANT_NAME:=admin} -if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then - echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi - 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 +check_for_db +check_for_keystone + mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql < /openrc <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi - if ! [ "$CINDER_DB_PASSWORD" ]; then CINDER_DB_PASSWORD=$(openssl rand -hex 15) export CINDER_DB_PASSWORD fi -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ - -p${DB_ROOT_PASSWORD} mysql < /openrc < /openrc < /openrc <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh account-server -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh container -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <&2 - exit 1 -fi - -if ! [ "$DB_ROOT_PASSWORD" ]; then - echo "*** Missing DB_ROOT_PASSWORD" >&2 - exit 1 -fi +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +check_for_db +check_for_keystone if ! [ "$SWIFT_DB_PASSWORD" ]; then SWIFT_DB_PASSWORD=$(openssl rand -hex 15) @@ -23,7 +18,7 @@ fi sh /opt/swift/config-swift.sh engine -mysql -h ${MARIADB_PORT_3306_TCP_ADDR} -u root \ +mysql -h ${MARIADB_SERVICE_HOST} -u root \ -p${DB_ROOT_PASSWORD} mysql <