class Minicron::Transport::SSH
Public Class Methods
new(options = {})
click to toggle source
Set all the options for the ssh instance
@option options [String] user @option options [String] host @option options [Integer] port @option options [String] path to the private key
# File lib/minicron/transport/ssh.rb, line 12 def initialize(options = {}) @user = options[:user] @host = options[:host] @port = options[:port] @private_key = File.expand_path(options[:private_key]) # TODO: Make these configurable? @auth_methods = ['publickey'] @host_key = 'ssh-rsa' @timeout = 10 end
Public Instance Methods
close()
click to toggle source
Close the SSH
connection
# File lib/minicron/transport/ssh.rb, line 45 def close @ssh.close end
exec!(command)
click to toggle source
Execute a command on the host and block until output is returned
@param command [String]
# File lib/minicron/transport/ssh.rb, line 40 def exec!(command) @ssh.exec!(command) end
open()
click to toggle source
Open the SSH
connection
# File lib/minicron/transport/ssh.rb, line 25 def open @ssh = Net::SSH.start( @host, @user, :port => @port, :keys => [@private_key], :auth_methods => @auth_methods, :host_key => @host_key, :timeout => @timeout ) end