diff --git a/lib/vmpooler/aws_setup.rb b/lib/vmpooler/aws_setup.rb index 90a0825..1beb3d0 100644 --- a/lib/vmpooler/aws_setup.rb +++ b/lib/vmpooler/aws_setup.rb @@ -13,7 +13,7 @@ module Vmpooler def self.setup_node_by_ssh(host, platform) @key_file = ENV['AWS_KEY_FILE_LOCATION'] conn = check_ssh_accepting_connections(host, platform) - configure_host(host, platform, conn) + configure_host(host, platform, conn) if conn end # For an Amazon Linux AMI, the user name is ec2-user. @@ -49,9 +49,18 @@ module Vmpooler netssh_jruby_workaround Net::SSH.start(host, user, keys: @key_file, timeout: 10) rescue Net::SSH::ConnectionTimeout, Errno::ECONNREFUSED => e - puts "Requested instances do not have sshd ready yet, try again: #{e}" + puts "Requested instances do not have sshd ready yet, try again for 300s: #{e}" sleep 1 retry if (retries += 1) < 300 + rescue Errno::EBADF => e + puts "Jruby error, try again for 30s: #{e}" + puts e.backtrace + sleep 1 + retry if (retries += 1) < 30 + rescue StandardError => e + puts "Other error, cancelling aws_setup for #{host}: #{e}" + puts e.backtrace + return nil end end