Ignore SSH errors

This commit adds the new parameter to the wait_for_exec_in_bootstrap
function for always return success when this parameter non-empty.
This functionality will be used in the last step of the installation
when we need to wait when Fuel master node installation ends.

Change-Id: I399000821a4a9aeed4d359da8d0e723ea1642c88
Closes-Bug: #1569537
Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
(cherry picked from commit 7dd1a24416)
This commit is contained in:
Maksim Malchuk 2016-04-12 22:22:25 +03:00
parent 1edb4f1cf0
commit afd03be44c
1 changed files with 5 additions and 1 deletions

View File

@ -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