class Chimp::ExecSSH
Attributes
ssh_user[RW]
Public Class Methods
new(h={})
click to toggle source
Calls superclass method
# File lib/right_chimp/exec/exec_ssh.rb, line 8 def initialize(h={}) super(h) @ssh_user = h[:ssh_user] end
Public Instance Methods
describe_work()
click to toggle source
# File lib/right_chimp/exec/exec_ssh.rb, line 27 def describe_work return "ExecSSH job_id=#{@job_id} command=\"#{@exec}\" server=\"#{@server.nickname}\"" end
info()
click to toggle source
# File lib/right_chimp/exec/exec_ssh.rb, line 31 def info return @exec.to_s end
run()
click to toggle source
# File lib/right_chimp/exec/exec_ssh.rb, line 13 def run host = @server.ip_address || nil @ssh_user ||= "root" 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()
click to toggle source
# File lib/right_chimp/exec/exec_ssh.rb, line 35 def target return @server.nickname end