Sha256: 7817881f0662bc2aacaa628be5f519da8663aa5bd66e86afe2a2b4b23488d778
Contents?: true
Size: 1.18 KB
Versions: 15
Compression:
Stored size: 1.18 KB
Contents
require 'net/ftp' module Backup module Record class FTP < 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::FTP.open(ip, user, password) do |ftp| backups.each do |backup| puts "\nDestroying backup \"#{backup.filename}\" from path \"#{backup.path}\"." begin ftp.chdir(backup.path) ftp.delete(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
15 entries across 15 versions & 4 rubygems