Sha256: 3dded4578cc2002a7bdde1dde8c7c007019ffe8c40645fc8cce28f416d786451
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module Backup module Record class SFTP < Backup::Record::Base attr_accessor :ip, :user, :password def load_specific_settings(adapter) %w(ip user password path).each do |method| send(:"#{method}=", adapter.procedure.get_storage_configuration.attributes[method]) end end private def self.destroy_backups(procedure, backups) ip = procedure.get_storage_configuration.attributes['ip'] user = procedure.get_storage_configuration.attributes['user'] password = procedure.get_storage_configuration.attributes['password'] Net::SFTP.start(ip, user, :password => password) do |sftp| backups.each do |backup| puts "\nDestroying backup \"#{backup.filename}\" from path \"#{backup.path}\"." begin sftp.remove!(File.join(backup.path, backup.filename)) backup.destroy rescue puts "Could not find backup #{backup.path}/#{backup.filename}.." backup.destroy end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
backup-gundua-2.3.1.2 | lib/backup/record/sftp.rb |
backup-gundua-2.3.1.1 | lib/backup/record/sftp.rb |