Browse code

Merge "Fix curl issue when SERVICE_HOST is defined to IPv6 address"

Jenkins authored on 2015/03/03 05:42:57
Showing 6 changed files
... ...
@@ -36,7 +36,7 @@ source $TOP_DIR/exerciserc
36 36
 is_service_enabled horizon || exit 55
37 37
 
38 38
 # can we get the front page
39
-curl http://$SERVICE_HOST 2>/dev/null | grep -q '<h3.*>Log In</h3>' || die $LINENO "Horizon front page not functioning!"
39
+$CURL_GET http://$SERVICE_HOST 2>/dev/null | grep -q '<h3.*>Log In</h3>' || die $LINENO "Horizon front page not functioning!"
40 40
 
41 41
 set +o xtrace
42 42
 echo "*********************************************************************"
... ...
@@ -35,7 +35,7 @@ source $TOP_DIR/exerciserc
35 35
 
36 36
 is_service_enabled sahara || exit 55
37 37
 
38
-curl http://$SERVICE_HOST:8386/ 2>/dev/null | grep -q 'Auth' || die $LINENO "Sahara API isn't functioning!"
38
+$CURL_GET http://$SERVICE_HOST:8386/ 2>/dev/null | grep -q 'Auth' || die $LINENO "Sahara API isn't functioning!"
39 39
 
40 40
 set +o xtrace
41 41
 echo "*********************************************************************"
... ...
@@ -35,7 +35,7 @@ source $TOP_DIR/exerciserc
35 35
 
36 36
 is_service_enabled zaqar-server || exit 55
37 37
 
38
-curl http://$SERVICE_HOST:8888/v1/ 2>/dev/null | grep -q 'queue_name' || die $LINENO "Zaqar API not functioning!"
38
+$CURL_GET http://$SERVICE_HOST:8888/v1/ 2>/dev/null | grep -q 'queue_name' || die $LINENO "Zaqar API not functioning!"
39 39
 
40 40
 set +o xtrace
41 41
 echo "*********************************************************************"
... ...
@@ -325,13 +325,15 @@ function use_database {
325 325
     fi
326 326
 }
327 327
 
328
+#Macro for curl statements. curl requires -g option for literal IPv6 addresses.
329
+CURL_GET="${CURL_GET:-curl -g}"
328 330
 
329 331
 # Wait for an HTTP server to start answering requests
330 332
 # wait_for_service timeout url
331 333
 function wait_for_service {
332 334
     local timeout=$1
333 335
     local url=$2
334
-    timeout $timeout sh -c "while ! curl -k --noproxy '*' -s $url >/dev/null; do sleep 1; done"
336
+    timeout $timeout sh -c "while ! $CURL_GET -k --noproxy '*' -s $url >/dev/null; do sleep 1; done"
335 337
 }
336 338
 
337 339
 
... ...
@@ -340,7 +340,7 @@ function start_ceilometer {
340 340
     # only die on API if it was actually intended to be turned on
341 341
     if is_service_enabled ceilometer-api; then
342 342
         echo "Waiting for ceilometer-api to start..."
343
-        if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -s http://localhost:8777/v2/ >/dev/null; do sleep 1; done"; then
343
+        if ! wait_for_service $SERVICE_TIMEOUT $CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/v2/; then
344 344
             die $LINENO "ceilometer-api did not start"
345 345
         fi
346 346
     fi
... ...
@@ -564,7 +564,7 @@ function start_keystone {
564 564
     # Check that the keystone service is running. Even if the tls tunnel
565 565
     # should be enabled, make sure the internal port is checked using
566 566
     # unencryted traffic at this point.
567
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -k -s $auth_protocol://$KEYSTONE_SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/ >/dev/null; do sleep 1; done"; then
567
+    if ! wait_for_service $SERVICE_TIMEOUT $auth_protocol://$KEYSTONE_SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/; then
568 568
         die $LINENO "keystone did not start"
569 569
     fi
570 570