Class: RemotesCommand
- Inherits:
-
SSHCommand
- Object
- GenericCommand
- SSHCommand
- RemotesCommand
- Defined in:
- lib/CommandManager.rb
Instance Attribute Summary
Attributes inherited from SSHCommand
Attributes inherited from GenericCommand
#code, #command, #stderr, #stdout
Class Method Summary collapse
-
.run(command, host, remote_dir, logger = nil, stdin = nil, retries = 0) ⇒ Object
Creates a command and runs it.
Methods inherited from SSHCommand
Methods inherited from GenericCommand
#get_error_message, #initialize, #log, #run
Constructor Details
This class inherits a constructor from SSHCommand
Class Method Details
.run(command, host, remote_dir, logger = nil, stdin = nil, retries = 0) ⇒ Object
Creates a command and runs it
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/CommandManager.rb', line 164 def self.run(command, host, remote_dir, logger=nil, stdin=nil, retries=0) cmd_file = command.split(' ')[0] cmd_string = "'if [ -x \"#{cmd_file}\" ]; then #{command}; else\ exit #{MAGIC_RC}; fi'" cmd = self.new(cmd_string, host, logger, stdin) cmd.run while cmd.code != 0 and retries != 0 if cmd.code == MAGIC_RC update_remotes(host, remote_dir, logger) end sleep 1 cmd.run retries = retries - 1 end cmd end |