Sha256: 558f7af19fd625f9de8f04ade9a2703887edc72806701cba6d3109da2da40c7a
Contents?: true
Size: 931 Bytes
Versions: 4
Compression:
Stored size: 931 Bytes
Contents
module Backup module Storage class SFTP attr_accessor :user, :password, :ip, :path, :tmp_path, :final_file # Stores the backup file on the remote server using SFTP 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::SFTP.start(ip, user, :password => password) do |sftp| begin puts "Storing \"#{final_file}\" to path \"#{path}\" on remote server (#{ip})." sftp.upload!(File.join(tmp_path, final_file).gsub('\ ', ' '), File.join(path, final_file)) rescue raise "Could not find \"#{path}\" on \"#{ip}\", please ensure this directory exists." end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
backup-2.3.0.1 | lib/backup/storage/sftp.rb |
backup-2.3.0 | lib/backup/storage/sftp.rb |
backup-2.2.1 | lib/backup/storage/sftp.rb |
backup-2.2.0 | lib/backup/storage/sftp.rb |