]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Wait for instance startup in GettingStarted test
authorZane Bitter <zbitter@redhat.com>
Fri, 18 May 2012 12:02:38 +0000 (14:02 +0200)
committerZane Bitter <zbitter@redhat.com>
Fri, 18 May 2012 12:02:38 +0000 (14:02 +0200)
Signed-off-by: Zane Bitter <zbitter@redhat.com>
docs/GettingStarted.rst

index dcd7f14f8c0386aaf9b7e8cefda6c93d67849534..23ca5ce4ff3dc1a3a393a5a10128a47e66d38fd2 100644 (file)
@@ -198,29 +198,59 @@ Describe the ``wordpress`` stack
     EOF
     )
 
+After a few seconds, the ``StackStatus`` should change from ``IN_PROGRESS`` to ``CREATE_COMPLETE``.
+
+..
+    # Wait for Stack creation
+    CREATING='"StackStatus": "IN_PROGRESS"'
+    retries=24
+    while $HEAT_DESCRIBE | grep -q '"StackStatus": "IN_PROGRESS"' &&          \
+          ((retries-- > 0))
+    do
+        echo "Waiting for Stack creation to complete..." >&2
+        sleep 5
+    done
+    
+    $HEAT_DESCRIBE | grep -q '"StackStatus": "CREATE_COMPLETE"'
+    
+
 Verify instance creation
 ------------------------
 
-Because the software takes some time to install from the repository, it may be a few minutes before the Wordpress intance is in a running state.  One way to check is to login via ssh and ``tail -f /var/log/yum.log``.  Once mysql-server installs, the instance should be ready to go.
+Because the software takes some time to install from the repository, it may be a few minutes before the Wordpress intance is in a running state.  One way to check is to login via ssh and ``tail -f /var/log/yum.log``.  Once ``mysql-server`` installs, the instance should be ready to go.
 
 ..
-    # Wait for instance to start
-    retries=0
-    DONE_STATUS='"StackStatus": "CREATE_COMPLETE"'
-    while ((retries++ < 24)) && ! $HEAT_DESCRIBE | grep -q "$DONE_STATUS"; do
-        echo "Waiting for instance to become ACTIVE..." >&2
-        sleep 5
+    WebsiteURL=$($HEAT_DESCRIBE | sed -e '/"OutputKey": "WebsiteURL"/,/}/ {'  \
+                                      -e '/"OutputValue":/ {'                 \
+                                      -e 's/[^:]*": "//'                      \
+                                      -e 's/",\?[[:space:]]*$//'              \
+                                      -e p -e '}' -e '}' -e d)
+    HOST=`echo $WebsiteURL | sed -r -e 's#http://([^/]+)/.*#\1#'`
+    
+    retries=9
+    while ! ping -q -c 1 $HOST && ((retries-- > 0)); do
+        echo "Waiting for host networking..." >&2
+        sleep 2
     done
+    test $retries -ge 0
     
-    WebsiteURL=$($HEAT_DESCRIBE | sed -e '/"OutputKey": "WebsiteURL"/,/}/ {' \
-                                      -e '/"OutputValue":/ {'                \
-                                      -e 's/[^:]*": "//'       \
-                                      -e 's/",\?[[:space:]]*$//'       \
-                                      -e p -e '}' -e '}' -e d)
+    sleep 10
+    
+    retries=49
+    while ! ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no  \
+                -q -t -l ec2-user $HOST                                   \
+                sudo grep -q mysql-server /var/log/yum.log &&             \
+          ((retries-- > 0))
+    do
+        echo "Waiting for package installation..." >&2
+        sleep 5
+    done
+    test $retries -ge 0
     
-    sleep 120
+    echo "Pausing to wait for application startup..." >&2
+    sleep 60
 
-Point web browser at the location given by the ``WebsiteURL`` Output as shown by ``heat describe``)::
+Point a web browser at the location given by the ``WebsiteURL`` Output as shown by ``heat describe``::
 
     wget ${WebsiteURL}