Sha256: 0a895b381116f49ede66c5cc42729fa767c441b55a7f0cef16f13574b3fbe821
Contents?: true
Size: 868 Bytes
Versions: 4
Compression:
Stored size: 868 Bytes
Contents
module Backup module Storage class SCP attr_accessor :user, :password, :ip, :path, :tmp_path, :final_file # Stores the file on the remote server using SCP def initialize(adapter) %w(ip user password path).each do |method| send(:"#{method}=", adapter.procedure.get_storage_configuration.attributes[method]) end final_file = adapter.final_file tmp_path = adapter.tmp_path Net::SSH.start(ip, user, :password => password) do |ssh| ssh.exec "mkdir -p #{path}" end puts "Storing \"#{final_file}\" to path \"#{path}\" on remote server (#{ip})." Net::SCP.start(ip, user, :password => password) do |scp| scp.upload! File.join(tmp_path, final_file).gsub('\ ', ' '), path end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
backup-2.1.2 | lib/backup/storage/scp.rb |
backup-2.1.1 | lib/backup/storage/scp.rb |
backup-2.1.0 | lib/backup/storage/scp.rb |
backup-2.0.0 | lib/backup/storage/scp.rb |