gfraboni | d076951 | 2017-09-22 15:31:48 -0400 | [diff] [blame] | 1 | ## Query the health check API. |
jasmineWen | 85d9d73 | 2018-03-06 16:13:35 +0000 | [diff] [blame] | 2 | HEALTH_CHECK_ENDPOINT="http://sdc-fe.{{ .Values.nsPrefix }}:8181/sdc1/rest/healthCheck" |
gfraboni | d076951 | 2017-09-22 15:31:48 -0400 | [diff] [blame] | 3 | HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT) |
| 4 | |
| 5 | ## Strip out the ON_BOARDING section from the response XML (otherwise we will |
| 6 | ## get duplicate results when we search for component CASSANDRA) and check to see if |
| 7 | ## the CASSANDRA component is reported as up. |
| 8 | READY=$(echo "$HEALTH_CHECK_RESPONSE" | sed '/ON_BOARDING/,/]/d' | grep -A 1 "CASSANDRA" | grep "UP") |
| 9 | |
| 10 | if [ -n $READY ]; then |
| 11 | echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT" |
| 12 | echo "Produces response: $HEALTH_CHECK_RESPONSE" |
| 13 | echo "Application is not in an available state" |
| 14 | return 2 |
| 15 | else |
| 16 | echo "Application is available." |
| 17 | return 0 |
| 18 | fi |