summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-12-17 21:08:04 +0000
committerGerrit Code Review <review@openstack.org>2014-12-17 21:08:04 +0000
commit1cd21fef483e863ad64909354eddf6b2b2b293e6 (patch)
tree7658b432b58434da0e3539de4f70d700d4971f65
parent6c1693aa0125dd762accbdb31e6980cb8171519c (diff)
parente1b90581c0da0a9bb1b3d5d1b82ca11eb9cfad31 (diff)
downloadkolla-1cd21fef483e863ad64909354eddf6b2b2b293e6.tar.gz
kolla-1cd21fef483e863ad64909354eddf6b2b2b293e6.zip
Merge "Reduce code duplication in kolla-common.sh"
-rw-r--r--docker/fedora-rdo-base/kolla-common.sh61
1 files changed, 21 insertions, 40 deletions
diff --git a/docker/fedora-rdo-base/kolla-common.sh b/docker/fedora-rdo-base/kolla-common.sh
index b917ebd68..c0031fb21 100644
--- a/docker/fedora-rdo-base/kolla-common.sh
+++ b/docker/fedora-rdo-base/kolla-common.sh
@@ -17,59 +17,40 @@ check_required_vars() {
done
}
-# Exit unless we receive a successful response from the Glance API.
-check_for_glance() {
- check_required_vars GLANCE_API_SERVICE_HOST
- GLANCE_API_URL="http://${GLANCE_API_SERVICE_HOST}:9292/"
-
- curl -sf -o /dev/null "$GLANCE_API_URL" || {
- echo "ERROR: glance is not available @ $GLANCE_API_URL" >&2
- exit 1
- }
+# Exit unless we receive a successful response from corresponding OpenStack
+# service.
+check_for_os_service() {
+ local name=$1
+ local host_var=$2
+ local port=$3
+ local api_version=$4
- echo "glance is active @ $GLANCE_API_URL"
-}
+ check_required_vars $host_var
-# Exit unless we receive a successful response from the Keystone API.
-check_for_keystone() {
- check_required_vars KEYSTONE_PUBLIC_SERVICE_HOST
+ local endpoint="http://${!host_var}:$port/$api_version"
- KEYSTONE_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
-
- curl -sf -o /dev/null "$KEYSTONE_URL" || {
- echo "ERROR: keystone is not available @ $KEYSTONE_URL" >&2
+ curl -sf -o /dev/null "$endpoint" || {
+ echo "ERROR: $name is not available @ $endpoint" >&2
exit 1
}
- echo "keystone is active @ $KEYSTONE_URL"
+ echo "$name is active @ $endpoint"
}
-# Exit unless we receive a successful response from the Nova API.
-check_for_nova() {
- check_required_vars NOVA_API_SERVICE_HOST
-
- NOVA_API_URL="http://${NOVA_API_SERVICE_HOST}:8774"
+check_for_glance() {
+ check_for_os_service glance GLANCE_API_SERVICE_HOST 9292
+}
- curl -sf -o /dev/null "$NOVA_API_URL" || {
- echo "ERROR: nova is not available @ $NOVA_API_URL" >&2
- exit 1
- }
+check_for_keystone() {
+ check_for_os_service keystone KEYSTONE_PUBLIC_SERVICE_HOST 5000 v2.0
+}
- echo "nova is active @ $NOVA_API_URL"
+check_for_nova() {
+ check_for_os_service nova NOVA_API_SERVICE_HOST 8774
}
-# Exit unless we receive a successful response from the Neutron API.
check_for_neutron() {
- check_required_vars NEUTRON_API_SERVICE_HOST
-
- NEUTRON_API_URL="http://${NEUTRON_SERVER_SERVICE_HOST}:9696"
-
- curl -sf -o /dev/null "$NEUTRON_API_URL" || {
- echo "ERROR: neutron is not available @ $NEUTRON_API_URL" >&2
- exit 1
- }
-
- echo "neutron is active @ $NEUTRON_API_URL"
+ check_for_os_service neutron NEUTRON_SERVER_SERVICE_HOST 9696
}
# Exit unless we receive a successful response from the database server.