93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/maws/commands/configure.rb', line 93
def ssh_connect_to(instance)
host = options.hostname || instance.dns_name
user = options.login_name
identity_file = options.identity_file || File.join(KEYPAIRS_PATH, "#{instance.keypair}.pem")
raise ArgumentError.new("Missing identity file: #{identity_file}") if !File.exists?(identity_file)
info "connecting to '#{user}@#{host}'..."
3.times { begin
return Net::SSH.start(host, user, { :keys => [identity_file], :verbose => :warn, :auth_methods => ["publickey"], :keys_only => true })
rescue Errno::EHOSTUNREACH
sleep 2
end
}
end
|