10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/ec2cssh/cli.rb', line 10
def connect servers_name_pattern
ec2ssh_update_command = options.ec2ssh_update
cssh_command = options.cssh
port = options.port.nil? ? '' : ':' + options.port
ec2ssh_update_result = `#{ec2ssh_update_command}`
puts ec2ssh_update_command
puts ec2ssh_update_result
puts
servers = ec2ssh_update_result.scan(/^Host\s(#{servers_name_pattern})/).map{|matches| "#{matches.first}#{port}" }.join(' ')
puts servers_name_pattern
puts servers
puts
puts "#{cssh_command} #{servers}"
puts `#{cssh_command} #{servers}`
end
|