| Sean Dague | 0da8dbd | 2012-11-29 14:37:14 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash | 
|  | 2 |  | 
|  | 3 | # **horizon.sh** | 
|  | 4 |  | 
|  | 5 | # Sanity check that horizon started if enabled | 
|  | 6 |  | 
|  | 7 | echo "*********************************************************************" | 
|  | 8 | echo "Begin DevStack Exercise: $0" | 
|  | 9 | echo "*********************************************************************" | 
|  | 10 |  | 
|  | 11 | # This script exits on an error so that errors don't compound and you see | 
| Joe Gordon | 4640026 | 2013-06-30 04:32:27 -0700 | [diff] [blame] | 12 | # only the first error that occurred. | 
| Sean Dague | 0da8dbd | 2012-11-29 14:37:14 -0500 | [diff] [blame] | 13 | set -o errexit | 
|  | 14 |  | 
|  | 15 | # Print the commands being run so that we can see the command that triggers | 
|  | 16 | # an error.  It is also useful for following allowing as the install occurs. | 
|  | 17 | set -o xtrace | 
|  | 18 |  | 
|  | 19 |  | 
|  | 20 | # Settings | 
|  | 21 | # ======== | 
|  | 22 |  | 
|  | 23 | # Keep track of the current directory | 
|  | 24 | EXERCISE_DIR=$(cd $(dirname "$0") && pwd) | 
|  | 25 | TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) | 
|  | 26 |  | 
|  | 27 | # Import common functions | 
|  | 28 | source $TOP_DIR/functions | 
|  | 29 |  | 
|  | 30 | # Import configuration | 
|  | 31 | source $TOP_DIR/openrc | 
|  | 32 |  | 
|  | 33 | # Import exercise configuration | 
|  | 34 | source $TOP_DIR/exerciserc | 
|  | 35 |  | 
|  | 36 | is_service_enabled horizon || exit 55 | 
|  | 37 |  | 
|  | 38 | # can we get the front page | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 39 | curl http://$SERVICE_HOST 2>/dev/null | grep -q '<h3>Log In</h3>' || die $LINENO "Horizon front page not functioning!" | 
| Sean Dague | 0da8dbd | 2012-11-29 14:37:14 -0500 | [diff] [blame] | 40 |  | 
|  | 41 | set +o xtrace | 
|  | 42 | echo "*********************************************************************" | 
|  | 43 | echo "SUCCESS: End DevStack Exercise: $0" | 
|  | 44 | echo "*********************************************************************" | 
|  | 45 |  |