diff --git a/functions/product.sh b/functions/product.sh index 3b2d373..1520357 100755 --- a/functions/product.sh +++ b/functions/product.sh @@ -30,6 +30,7 @@ wait_for_exec_in_bootstrap() { password=$3 prompt=$4 cmd=$5 + ignore_ssh_errors=$6 # Log in into the VM, exec cmd and print exitcode # Looks a bit ugly, but 'end of expect' has to be in the very beginning of the line @@ -48,6 +49,9 @@ wait_for_exec_in_bootstrap() { expect "$prompt" ENDOFEXPECT ) + ssh_error=$(echo "$result" | egrep "ssh:\s") + [ -n "$ssh_error" -a -n "$ignore_ssh_errors" ] && return 0 + [ -n "$ssh_error" -a -z "$ignore_ssh_errors" ] && return 1 echo "$result" | grep -q "[r]c=0" >&2 && return 0 return 1 } @@ -84,7 +88,7 @@ wait_for_product_vm_to_install() { # Loop until master node gets successfully installed maxdelay=3000 - while wait_for_exec_in_bootstrap $ip $username $password "$prompt" "ps xa | grep '\[b\]ootstrap_admin_node.sh'"; do + while wait_for_exec_in_bootstrap $ip $username $password "$prompt" "ps xa | grep '\[b\]ootstrap_admin_node.sh'" ignore_ssh_errors ; do sleep 5 ((waited += 5)) if (( waited >= maxdelay )); then