make remote tasks a lot simpler

This commit is contained in:
John Bintz 2011-08-31 07:00:22 -04:00
parent 0685b5436f
commit c88f16b7a2
1 changed files with 3 additions and 23 deletions

View File

@ -313,29 +313,9 @@ module Hydra #:nodoc:
def run_command worker, command def run_command worker, command
$stdout.write "==== Hydra Running #{@name} on #{worker['connect']} ====\n" $stdout.write "==== Hydra Running #{@name} on #{worker['connect']} ====\n"
ssh_opts = worker.fetch('ssh_opts') { '' } ssh_opts = worker.fetch('ssh_opts') { '' }
writer, reader, error = popen3("ssh -tt #{ssh_opts} #{worker['connect']} ")
writer.write("cd #{worker['directory']}\n") system %{ssh -tt #{ssh_opts} #{worker['connect']} 'cd #{worker['directory']} && #{command}'}
writer.write "echo BEGIN HYDRA\n" $?.exitstatus == 0
writer.write(command + "\r")
writer.write "echo END HYDRA\n"
writer.write("exit\n")
writer.close
ignoring = true
passed = true
while line = reader.gets
line.chomp!
if line =~ /^rake aborted!$/
passed = false
end
if line =~ /echo END HYDRA$/
ignoring = true
end
$stdout.write "#{worker['connect']}: #{line}\n" unless ignoring
if line == 'BEGIN HYDRA'
ignoring = false
end
end
passed
end end
end end