support providing a timeout to rsync for slower connections
This commit is contained in:
parent
265cb5021a
commit
236de8be1a
|
@ -28,6 +28,7 @@ module Hydra #:nodoc:
|
||||||
@connect = worker_opts.fetch('connect') { raise "You must specify an SSH connection target" }
|
@connect = worker_opts.fetch('connect') { raise "You must specify an SSH connection target" }
|
||||||
@ssh_opts = worker_opts.fetch('ssh_opts') { "" }
|
@ssh_opts = worker_opts.fetch('ssh_opts') { "" }
|
||||||
@remote_dir = worker_opts.fetch('directory') { raise "You must specify a remote directory" }
|
@remote_dir = worker_opts.fetch('directory') { raise "You must specify a remote directory" }
|
||||||
|
@timeout = worker_opts.fetch('timeout') { 2 }
|
||||||
@result = 0
|
@result = 0
|
||||||
|
|
||||||
return unless sync_opts
|
return unless sync_opts
|
||||||
|
@ -50,7 +51,7 @@ module Hydra #:nodoc:
|
||||||
'rsync',
|
'rsync',
|
||||||
'-avz',
|
'-avz',
|
||||||
'--delete',
|
'--delete',
|
||||||
'--timeout=2',
|
"--timeout=#{@timeout}",
|
||||||
exclude_opts,
|
exclude_opts,
|
||||||
File.expand_path(@local_dir)+'/',
|
File.expand_path(@local_dir)+'/',
|
||||||
"-e \"ssh #{@ssh_opts}\"",
|
"-e \"ssh #{@ssh_opts}\"",
|
||||||
|
@ -58,6 +59,7 @@ module Hydra #:nodoc:
|
||||||
].join(" ")
|
].join(" ")
|
||||||
trace rsync_command
|
trace rsync_command
|
||||||
trace `#{rsync_command}`
|
trace `#{rsync_command}`
|
||||||
|
|
||||||
@result = $?.exitstatus
|
@result = $?.exitstatus
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue