Sha256: 2aa889cec68409f98ab6ac210c6d28a3cad8a33e49503b68fef97599e18ee1fe
Contents?: true
Size: 1.51 KB
Versions: 3
Compression:
Stored size: 1.51 KB
Contents
module Heirloom class Destroyer def initialize(args) @config = args[:config] @name = args[:name] @domain = "heirloom_#{@name}" @id = args[:id] @logger = @config.logger end def destroy(args) regions = args[:regions] keep_domain = args[:keep_domain] @logger.info "Destroying #{@name} - #{@id}" regions.each do |region| bucket = reader.get_bucket :region => region key = "#{@id}.tar.gz" if bucket @logger.info "Destroying 's3://#{bucket}/#{@name}/#{key}'." s3_destroyer = Destroyer::S3.new :config => @config, :region => region s3_destroyer.destroy_file :key_name => key, :bucket => bucket, :key_folder => @name end end sdb.delete @domain, @id destroy_domain unless keep_domain end private def destroy_domain # Simple DB is eventually consisten # Sleep for 3 sec for changes to reflect Kernel.sleep 3 if sdb.domain_empty? @domain @logger.info "Domain #{@domain} empty. Destroying." sdb.delete_domain @domain end @logger.info "Destroy complete." end def sdb @sdb ||= AWS::SimpleDB.new :config => @config end def reader @reader ||= Reader.new :config => @config, :name => @name, :id => @id end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.6.1 | lib/heirloom/archive/destroyer.rb |
heirloom-0.6.0rc1 | lib/heirloom/archive/destroyer.rb |
heirloom-0.5.0rc4 | lib/heirloom/archive/destroyer.rb |