class SSHCommand
Executes commands in a remote machine ussing ssh. See documentation for GenericCommand
Attributes
host[RW]
Public Class Methods
new(command, host, logger=nil, stdin=nil, timeout=nil)
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 183 def initialize(command, host, logger=nil, stdin=nil, timeout=nil) @host=host super(command, logger, stdin, timeout) end
run(command, host, logger=nil, stdin=nil, timeout=nil)
click to toggle source
Creates a command and runs it
# File lib/CommandManager.rb, line 175 def self.run(command, host, logger=nil, stdin=nil, timeout=nil) cmd=self.new(command, host, logger, stdin, timeout) cmd.run cmd end
Private Instance Methods
execute()
click to toggle source
# File lib/CommandManager.rb, line 190 def execute if @stdin Open3.popen3("ssh #{@host} #{@command} ; echo ExitCode: $? 1>&2", :pgroup => true) else Open3.popen3("ssh -n #{@host} #{@command} ; echo ExitCode: $? 1>&2", :pgroup => true) end end