Skip to content
Snippets Groups Projects
Commit 056e02d0 authored by Martin André's avatar Martin André
Browse files

Simplify `wait_for` calls

Rely on the the `check_for_*` functions and remove redundant
`fail_unless_*` calls.

Also change `wait_for` to exit when it is missing a required argument.

Change-Id: I90c4545691d53185556e2838303ac3df0afaf9fa
parent 34872c1c
No related merge requests found
...@@ -49,7 +49,7 @@ wait_for() { ...@@ -49,7 +49,7 @@ wait_for() {
if [ -z "$loops" -o -z "$sleeptime" -o -z "$command" ]; then if [ -z "$loops" -o -z "$sleeptime" -o -z "$command" ]; then
echo "wait_for is missing a required parameter" echo "wait_for is missing a required parameter"
return 1 exit 1
fi fi
local i=0 local i=0
......
...@@ -11,11 +11,7 @@ check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ ...@@ -11,11 +11,7 @@ check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
ADMIN_TENANT_NAME GLANCE_API_SERVICE_HOST \ ADMIN_TENANT_NAME GLANCE_API_SERVICE_HOST \
PUBLIC_IP PUBLIC_IP
wait_for 30 1 keystone \ wait_for 30 1 check_for_os_service_running keystone
--os-auth-url=http://${KEYSTONE_PUBLIC_SERVICE_HOST}:35357/v2.0 \
--os-username=admin --os-tenant-name=${ADMIN_TENANT_NAME} \
--os-password=${KEYSTONE_ADMIN_PASSWORD} endpoint-list
fail_unless_os_service_running keystone
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
......
...@@ -7,8 +7,7 @@ set -e ...@@ -7,8 +7,7 @@ set -e
check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD
# lets wait for the DB to be available # lets wait for the DB to be available
wait_for 25 1 mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" -e 'status;' wait_for 25 1 check_for_db
fail_unless_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF 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; CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME} DEFAULT CHARACTER SET utf8;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment