VBox - there are a lot of ssh.exe processes under Cygwin

When we execute the installation of the Fuel master node we are
launching ssh commands and checking messages in the file
bootstrap_admin_node.log. If the ssh processes accumulate in the
operating system you could see the following error: “The system
has no more ptys”.
Also Cygwin does not work correctly with the command
"send "res=$(for i in 1 2 3 4...)"

Change-Id: I30aab51452505e88c18abc866f88efde2d7650fb
Closes-Bug: #1457956
This commit is contained in:
Serhiy Ovsianikov 2015-05-25 09:59:59 +03:00
parent 5c8ebddf64
commit 13b3e9cf07
1 changed files with 21 additions and 15 deletions

View File

@ -93,6 +93,8 @@ is_product_vm_operational() {
expect "$prompt"
send "grep 'Fuel node deployment' /var/log/puppet/bootstrap_admin_node.log\r"
expect "$prompt"
send "logout\r"
expect "$prompt"
ENDOFEXPECT
)
@ -186,12 +188,10 @@ enable_outbound_network_for_product_vm() {
done
else
print_no_internet_connectivity_banner
return 1
fi
;;
*)
print_no_internet_connectivity_banner
return 1
;;
esac
@ -200,7 +200,6 @@ enable_outbound_network_for_product_vm() {
echo "OK"
else
print_no_internet_connectivity_banner
return 1
fi
# Check host nameserver configuration
@ -276,22 +275,29 @@ enable_outbound_network_for_product_vm() {
send "dockerctl check cobbler >/dev/null 2>&1\r"
expect "*ready*"
expect "$prompt"
send "logout\r"
expect "$prompt"
ENDOFEXPECT
)
result_inet=$(
expect << ENDOFEXPECT
spawn ssh $ssh_options $username@$ip
expect "connect to host" exit
expect "*?assword:*"
send "$password\r"
expect "$prompt"
send "rezult=$(for i in 1 2 3 4 5; do ping -c 2 google.com || ping -c 2 wikipedia.com || sleep 2; done)\r"
expect "$prompt"
send "echo $rezult\r"
expect "$prompt"
# Waiting until the network services are restarted.
# 5 seconds is optimal time for different operating systems.
echo -e "\nWaiting until the network services are restarted..."
sleep 5s
result_inet=$(
expect << ENDOFEXPECT
spawn ssh $ssh_options $username@$ip
expect "connect to host" exit
expect "*?assword:*"
send "$password\r"
expect "$prompt"
send "for i in {1..5}; do ping -c 2 google.com || ping -c 2 wikipedia.com || sleep 2; done\r"
expect "*icmp*"
expect "$prompt"
send "logout\r"
expect "$prompt"
ENDOFEXPECT
)
)
# When you are launching command in a sub-shell, there are issues with IFS (internal field separator)
# and parsing output as a set of strings. So, we are saving original IFS, replacing it, iterating over lines,