lib/backup/remote/command.rb in backup-remote-0.0.15 vs lib/backup/remote/command.rb in backup-remote-0.0.16
- old
+ new
@@ -125,24 +125,34 @@
# scp
f_temp = "/tmp/#{SecureRandom.uuid}"
# sshkit
- on host do |host|
- as(user: ssh_user) do
+ SSHKit::Coordinator.new(host).each in: :sequence do
+ # upload to temp file
+ upload! source_file, f_temp
- end
+ # upload to dest
+ execute("cp #{f_temp} #{dest_file}", interaction_handler: handler)
+ end
+
+=begin
+ on host do |host|
# NOT WORK with sudo
#upload! source_file, dest_file
- # upload to temp file
- upload! source_file, f_temp
- # upload to dest
- execute("cp #{f_temp} #{dest_file}", interaction_handler: handler)
+ as(user: ssh_user) do
+ # upload to temp file
+ upload! source_file, f_temp
+ # upload to dest
+ execute("cp #{f_temp} #{dest_file}", interaction_handler: handler)
+
+ end
end
+=end
#
return {res: 1, output: ""}
rescue => e
{