Browse Source

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>
Maksim Malchuk 3 years ago
parent
commit
7dd1a24416
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      functions/product.sh

+ 5
- 1
functions/product.sh View File

@@ -30,6 +30,7 @@ wait_for_exec_in_bootstrap() {
30 30
     password=$3
31 31
     prompt=$4
32 32
     cmd=$5
33
+    ignore_ssh_errors=$6
33 34
 
34 35
     # Log in into the VM, exec cmd and print exitcode
35 36
     # 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() {
48 49
         expect "$prompt"
49 50
 ENDOFEXPECT
50 51
     )
52
+    ssh_error=$(echo "$result" | egrep "ssh:\s")
53
+    [ -n "$ssh_error" -a -n "$ignore_ssh_errors" ] && return 0
54
+    [ -n "$ssh_error" -a -z "$ignore_ssh_errors" ] && return 1
51 55
     echo "$result" | grep -q "[r]c=0" >&2 && return 0
52 56
     return 1
53 57
 }
@@ -84,7 +88,7 @@ wait_for_product_vm_to_install() {
84 88
 
85 89
     # Loop until master node gets successfully installed
86 90
     maxdelay=3000
87
-    while wait_for_exec_in_bootstrap $ip $username $password "$prompt" "ps xa | grep '\[b\]ootstrap_admin_node.sh'"; do
91
+    while wait_for_exec_in_bootstrap $ip $username $password "$prompt" "ps xa | grep '\[b\]ootstrap_admin_node.sh'" ignore_ssh_errors ; do
88 92
         sleep 5
89 93
         ((waited += 5))
90 94
         if (( waited >= maxdelay )); then

Loading…
Cancel
Save