Default showmenu=yes, add workaround for VirtualBox

Change-Id: I763a76cf44a8ba69be4621375c782431eccaaf55
Closes-Bug: #1402519
This commit is contained in:
Matthew Mosesohn 2014-12-17 14:57:08 +03:00
parent 14301a16bb
commit 1679c27f65
3 changed files with 61 additions and 0 deletions

View File

@ -42,6 +42,10 @@ mount_iso_to_vm $name $iso_path
echo
start_vm $name
if [ "$skipfuelmenu" = "yes" ]; then
wait_for_fuel_menu $vm_master_ip $vm_master_username $vm_master_password "$vm_master_prompt"
fi
# Wait until the machine gets installed and Puppet completes its run
wait_for_product_vm_to_install $vm_master_ip $vm_master_username $vm_master_password "$vm_master_prompt"

View File

@ -181,3 +181,4 @@ vm_slave_third_disk_mb=65535
# Set to 1 to run VirtualBox in headless mode
headless=0
skipfuelmenu="no"

View File

@ -20,6 +20,62 @@
ssh_options='-oConnectTimeout=5 -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null -oRSAAuthentication=no -oPubkeyAuthentication=no'
wait_for_fuel_menu() {
ip=$1
username=$2
password=$3
prompt=$4
echo "Waiting for Fuel Menu so it can be skipped. Please do NOT abort the script..."
# Loop until master node gets successfully installed
maxdelay=3000
while ! skip_fuel_menu $ip $username $password "$prompt"; do
sleep 5
((waited += 5))
if (( waited >= maxdelay )); then
echo "Installation timed out! ($maxdelay seconds)" 1>&2
exit 1
fi
done
}
skip_fuel_menu() {
ip=$1
username=$2
password=$3
prompt=$4
# Log in into the VM, see if Fuel Setup is running or puppet already started
# Looks a bit ugly, but 'end of expect' has to be in the very beginning of the line
result=$(
expect << ENDOFEXPECT
spawn ssh $ssh_options $username@$ip
expect "connect to host" exit
expect "*?assword:*"
send "$password\r"
expect "$prompt"
send "pgrep 'fuelmenu|puppet';echo \"returns $?\"\r"
expect "$prompt"
ENDOFEXPECT
)
if [[ "$result" =~ "returns 0" ]]; then
echo "Skipping Fuel Setup..."
expect << ENDOFEXPECT
spawn ssh $ssh_options $username@$ip
expect "connect to host" exit
expect "*?assword:*"
send "$password\r"
expect "$prompt"
send "killall -w -SIGUSR1 fuelmenu\r"
expect "$prompt"
ENDOFEXPECT
return 0
else
return 1
fi
}
is_product_vm_operational() {
ip=$1
username=$2