devstack/exercises/sahara.sh
Rob Crittenden ce2d75df01 Remove hardcoded http in URL in sahara exercise script
The script hardcoded http://$SERVICE_HOST/... which failed
when SSL or tls-proxy was enabled. Calculate the protocol
based on enabled services instead.

Change-Id: I192eeeafe7bf4dc5cbd382c505ffb9307651d78a
2015-06-08 17:30:35 -04:00

50 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# **sahara.sh**
# Sanity check that Sahara started if enabled
echo "*********************************************************************"
echo "Begin DevStack Exercise: $0"
echo "*********************************************************************"
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
# Settings
# ========
# Keep track of the current directory
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
# Import common functions
source $TOP_DIR/functions
# Import configuration
source $TOP_DIR/openrc
# Import exercise configuration
source $TOP_DIR/exerciserc
is_service_enabled sahara || exit 55
if is_ssl_enabled_service "sahara" || is_service_enabled tls-proxy; then
SAHARA_SERVICE_PROTOCOL="https"
fi
SAHARA_SERVICE_PROTOCOL=${SAHARA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
$CURL_GET $SAHARA_SERVICE_PROTOCOL://$SERVICE_HOST:8386/ 2>/dev/null | grep -q 'Auth' || die $LINENO "Sahara API isn't functioning!"
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End DevStack Exercise: $0"
echo "*********************************************************************"