class SSHCommand

Executes commands in a remote machine ussing ssh. See documentation for GenericCommand

Attributes

host[RW]
ssh_opts[RW]

Public Class Methods

new(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='') click to toggle source

This one takes another parameter. host is the machine where the command is going to be executed

Calls superclass method GenericCommand::new
# File lib/CommandManager.rb, line 227
def initialize(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
    @host=host
    @ssh_opts = ssh_opts

    super(command, logger, stdin, timeout)
end
run(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='') click to toggle source

Creates a command and runs it

# File lib/CommandManager.rb, line 219
def self.run(command, host, logger=nil, stdin=nil, timeout=nil, ssh_opts='')
    cmd=self.new(command, host, logger, stdin, timeout, ssh_opts)
    cmd.run
    cmd
end

Private Instance Methods

execute() click to toggle source
# File lib/CommandManager.rb, line 236
def execute
    if @stdin
        capture3_timeout("ssh #{@ssh_opts} #{@host} #{@command}",
                        :pgroup => true, :stdin_data => @stdin)
    else
        capture3_timeout("ssh -n #{@ssh_opts} #{@host} #{@command}",
                        :pgroup => true)
    end
end