Created
February 6, 2014 23:32
-
-
Save dalen/8854722 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transfer files to a host in the NodeSet. | |
def rcp(opts) | |
dest = opts[:d].name | |
source = opts[:sp] | |
dest_path = opts[:dp] | |
fqdn = RSpec.configuration.rs_storage[:nodes][dest][:fqdn] | |
user = RSpec.configuration.rs_storage[:nodes][dest][:user] | |
# Grab a remote path for temp transfer | |
tmpdest = tmppath | |
cmd = "rsync -rl '#{source}' #{user}@#{fqdn}:#{tmpdest}" | |
output << " #{cmd}\n" | |
system(cmd) | |
# Now we move the file into their final destination | |
if File.directory? source | |
result = shell(:n => opts[:d], :c => "mv -f #{File.join(tmpdest, File.basename(source))} #{dest_path}") | |
else | |
result = shell(:n => opts[:d], :c => "mv -f #{tmpdest} #{dest_path}") | |
end | |
result[:exit_code] == 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment