Class: Chimp::ExecSSH
- Defined in:
- lib/right_chimp/exec/ExecSSH.rb
Constant Summary
Constants inherited from Executor
Chimp::Executor::STATUS_DONE, Chimp::Executor::STATUS_ERROR, Chimp::Executor::STATUS_HOLDING, Chimp::Executor::STATUS_NONE, Chimp::Executor::STATUS_RETRYING, Chimp::Executor::STATUS_RUNNING
Instance Attribute Summary collapse
-
#ssh_user ⇒ Object
Returns the value of attribute ssh_user.
Attributes inherited from Executor
#array, #dry_run, #error, #exec, #group, #inputs, #job_id, #owner, #quiet, #results, #retry_count, #retry_sleep, #server, #status, #template, #time_end, #time_start, #timeout, #verbose
Instance Method Summary collapse
- #describe_work ⇒ Object
- #info ⇒ Object
-
#initialize(h = {}) ⇒ ExecSSH
constructor
A new instance of ExecSSH.
- #run ⇒ Object
- #target ⇒ Object
Methods inherited from Executor
#cancel, #get_total_exec_time, #queue, #requeue
Constructor Details
#initialize(h = {}) ⇒ ExecSSH
Returns a new instance of ExecSSH.
8 9 10 11 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 8 def initialize(h={}) super(h) @ssh_user = h[:ssh_user] end |
Instance Attribute Details
#ssh_user ⇒ Object
Returns the value of attribute ssh_user.
6 7 8 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 6 def ssh_user @ssh_user end |
Instance Method Details
#describe_work ⇒ Object
32 33 34 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 32 def describe_work return "ExecSSH job_id=#{@job_id} command=\"#{@exec}\" server=\"#{@server['nickname']}\"" end |
#info ⇒ Object
36 37 38 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 36 def info return @exec.to_s end |
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 13 def run host = @server['ip_address'] || @server['ip-address'] || nil @ssh_user ||= "root" if host == nil @server.settings host = @server['ip_address'] || @server['ip-address'] end run_with_retry do Log.debug "ssh #{@ssh_user}@#{host} \"#{@exec}\"" success = system("ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{@ssh_user}@#{host} \"#{@exec}\"") if not $?.success? raise "SSH failed with status: #{$?}" end end end |
#target ⇒ Object
40 41 42 |
# File 'lib/right_chimp/exec/ExecSSH.rb', line 40 def target return @server['nickname'] end |