20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/dimension_shell/cli.rb', line 20
def connect(servername, *ssh_options)
_init_command(options)
shell_user = options[:shell_user] || configatron.shell_user || 'root'
result = @cloud_control.get_server servername
if result[:failure] then
_api_access_failed result
elsif result['totalCount'] != 1 then
_puts %Q(No servername matched to "#{servername}".)
else
server = result['server'].first
primary_ipv6 = server['networkInfo']['primaryNic']['ipv6']
puts "Server \"#{servername}\" found, opening secure shell to #{shell_user}@#{primary_ipv6}."
call = "ssh #{shell_user}@#{primary_ipv6}"
call += " " + ssh_options.join(" ") if ssh_options.any?
puts call
Kernel.exec(call)
end
end
|