#!/bin/bash # Delete the stack if exists openstack stack show -c id ${openstack_build_stack_name} && openstack stack delete -y --wait ${openstack_build_stack_name} sleep 1 # Create the stack openstack stack create -f yaml -e ${heat_environment} -t ${heat_template} --wait ${openstack_build_stack_name} sleep ${ssh_timeout} #TODO: Check if need to remove reference to "om_ran" in line below [eronkeo: 10-10-2019] ** DONE ** # build_node_ip=$(openstack server list -c Name -c Networks -f value | egrep ${openstack_build_stack_name} | awk '{print $NF}' | sed 's/om_ran=//g') build_node_ip=$(openstack server list -c Name -c Networks -f value | egrep ${openstack_build_stack_name} | awk '{print $NF}' | sed 's/.*=//g') ### Checking if the VM is up, if not retry till it is and continue with the script ### for n in $(seq 1 40); do timeout 1 ping -c 1 "${build_node_ip}" > /dev/null 2>&1 RESULT=$? if [ "$RESULT" -eq "0" ] ; then echo "RESULT: $RESULT" n=40 break else echo "Failed to connect to "${build_node_ip}". RESULT: $RESULT - Retrying in 10 seconds..." sleep 10 fi done echo echo "========================================" echo "build node ip: ${build_node_ip}" echo "========================================" echo