mirror of
https://github.com/puppetlabs/vmpooler-provider-ec2.git
synced 2026-01-26 10:28:41 -05:00
adding more error handling when doing the net::ssh aws_setup portion
This commit is contained in:
parent
0bff2df079
commit
cd6ebae825
1 changed files with 11 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ module Vmpooler
|
||||||
def self.setup_node_by_ssh(host, platform)
|
def self.setup_node_by_ssh(host, platform)
|
||||||
@key_file = ENV['AWS_KEY_FILE_LOCATION']
|
@key_file = ENV['AWS_KEY_FILE_LOCATION']
|
||||||
conn = check_ssh_accepting_connections(host, platform)
|
conn = check_ssh_accepting_connections(host, platform)
|
||||||
configure_host(host, platform, conn)
|
configure_host(host, platform, conn) if conn
|
||||||
end
|
end
|
||||||
|
|
||||||
# For an Amazon Linux AMI, the user name is ec2-user.
|
# For an Amazon Linux AMI, the user name is ec2-user.
|
||||||
|
|
@ -49,9 +49,18 @@ module Vmpooler
|
||||||
netssh_jruby_workaround
|
netssh_jruby_workaround
|
||||||
Net::SSH.start(host, user, keys: @key_file, timeout: 10)
|
Net::SSH.start(host, user, keys: @key_file, timeout: 10)
|
||||||
rescue Net::SSH::ConnectionTimeout, Errno::ECONNREFUSED => e
|
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
|
sleep 1
|
||||||
retry if (retries += 1) < 300
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue