Fix for sshd taking too long problem 89/24489/3
authorLusheng Ji <lji@research.att.com>
Mon, 20 Nov 2017 19:06:52 +0000 (14:06 -0500)
committerLusheng Ji <lji@research.att.com>
Tue, 21 Nov 2017 20:03:06 +0000 (20:03 +0000)
Under certain conditions, it takes longer than 10 seconds
on the cloudify manager VM from the time its IP stack becoming
ready (echoing to ICMP) to the time its sshd becoming ready.
This causes the ssh-into-cloudify-manager-VM command to fail.
The implemented solution is to replace the ping test-wait loop with
a TCP port 22 open test-wait loop.

Issue-Id: DCAEGEN2-201
Change-Id: I9b734a9ff58ec9e97dc0102dc2ba86756e50f135
Signed-off-by: Lusheng Ji <lji@research.att.com>
bootstrap/installer-docker.sh-template

index 2a26763..b056ca1 100755 (executable)
@@ -132,27 +132,16 @@ cfy local init --install-plugins -p ./blueprints/centos_vm.yaml -i /tmp/local_in
 cfy local execute -w install --task-retries=10
 PUBIP=$(cfy local outputs | grep -Po '"public_ip": "\K.*?(?=")')
 
-
-## It's probably not completely ready when the installation finish, so wait
-#sleep 180
-while [ $( ping -c 1 $PUBIP 2> /dev/null | grep icmp* | wc -l ) -eq 0 ];
-do
-  sleep 5
-  echo "."
-done
+# wait till the cloudify manager's sshd ready
+while ! nc -z -v -w5 ${PUBIP} 22; do echo "."; done
 sleep 10
 
 echo "Installing Cloudify Manager on ${PUBIP}."
-
 PVTIP=$(ssh $SSHOPTS -i "$PVTKEY" "$SSHUSER"@"$PUBIP" 'echo PVTIP=`curl --silent http://169.254.169.254/2009-04-04/meta-data/local-ipv4`' | grep PVTIP | sed 's/PVTIP=//')
 if [ "$PVTIP" = "" ]
 then
-       echo Cannot access specified machine at $PUBIP using supplied credentials
-       # Don't exit--keep the container up so we can uninstall the VM and supporting entities
-       while true
-    do
-        sleep 300
-    done
+    echo Cannot access specified machine at $PUBIP using supplied credentials
+    exit
 fi