lib/shelly/cli/main.rb in shelly-0.4.27 vs lib/shelly/cli/main.rb in shelly-0.4.28.pre
- old
+ new
@@ -28,11 +28,11 @@
check_unknown_options!(:except => :rake)
# FIXME: it should be possible to pass single symbol, instead of one element array
before_hook :logged_in?, :only => [:add, :status, :list, :start, :stop,
:delete, :info, :ip, :logout, :execute, :rake, :setup, :console,
- :dbconsole, :mongoconsole, :redis_cli]
+ :dbconsole, :mongoconsole, :redis_cli, :ssh]
before_hook :inside_git_repository?, :only => [:add, :setup, :check]
map %w(-v --version) => :version
desc "version", "Display shelly version"
def version
@@ -359,9 +359,23 @@
rescue Client::ConflictException
say_error "Cloud #{app} is not running. Cannot run console."
rescue Client::NotFoundException => e
raise unless e.resource == :virtual_server
say_error "Virtual server '#{options[:server]}' not found or not configured for running console"
+ end
+
+ desc "ssh", "Log into virtual server"
+ method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
+ method_option :server, :type => :string, :aliases => "-s",
+ :desc => "Specify virtual server, it's random by default"
+ def ssh
+ app = multiple_clouds(options[:cloud], "ssh")
+ app.ssh_console(options[:server])
+ rescue Client::ConflictException
+ say_error "Cloud #{app} is not running. Cannot run ssh console."
+ rescue Client::NotFoundException => e
+ raise unless e.resource == :virtual_server
+ say_error "Virtual server '#{options[:server]}' not found or not configured for running ssh console"
end
# FIXME: move to helpers
no_tasks do
# Returns valid arguments for rake, removes shelly gem arguments