Class: SSHCommand

Inherits:
GenericCommand show all
Defined in:
lib/CommandManager.rb

Overview

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

Direct Known Subclasses

RemotesCommand

Instance Attribute Summary collapse

Attributes inherited from GenericCommand

#code, #command, #stderr, #stdout

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GenericCommand

#get_error_message, #log, #run, #to_xml

Constructor Details

#initialize(command, host, logger = nil, stdin = nil, timeout = nil, ssh_opts = '') ⇒ SSHCommand

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



227
228
229
230
231
232
# 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

Instance Attribute Details

#hostObject

Returns the value of attribute host.



216
217
218
# File 'lib/CommandManager.rb', line 216

def host
  @host
end

#ssh_optsObject

Returns the value of attribute ssh_opts.



216
217
218
# File 'lib/CommandManager.rb', line 216

def ssh_opts
  @ssh_opts
end

Class Method Details

.run(command, host, logger = nil, stdin = nil, timeout = nil, ssh_opts = '') ⇒ Object

Creates a command and runs it



219
220
221
222
223
# 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