Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: a49e1a76a8
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (37 sloc) 1.144 kB
module Claws
module Command
class EC2
def self.exec(options)
begin
config = Claws::Configuration.new( options.config_file )
rescue Claws::ConfigurationError => e
puts e.message
puts 'Use the --init option to create a configuration file.'
exit 1
end
begin
instances = Claws::Collection::EC2.new(config).get
rescue Exception => e
puts e.message
end
Claws::Report::EC2.new( config, instances ).run
if options.connect
if instances.size == 1
puts
selection = 0
elsif options.selection
puts
selection = options.selection
else
print "Select server (enter q to quit): "
selection = gets.chomp
exit 0 if selection.match(/^q.*/i)
end
puts 'connecting to server...'
identity = config.ssh.identity.nil? ? '' : "-i #{config.ssh.identity} "
system "ssh #{identity}#{config.ssh.user}@#{instances[selection.to_i].dns_name}"
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.