Sha256: 720c1a54386227f6ca0305e769cfa9fe65a2cd44a4bc47fe24bf0fd319bf97ea

Contents?: true

Size: 1.36 KB

Versions: 29

Compression:

Stored size: 1.36 KB

Contents

module Heirloom

  class Verifier

    def initialize(args)
      @config = args[:config]
      @name = args[:name]
      @logger = @config.logger
    end

    def buckets_exist?(args)
      bucket_prefix = args[:bucket_prefix]
      regions = args[:regions]
      result = true

      regions.each do |region|
        unless bucket_exists? :region        => region,
                              :bucket_prefix => bucket_prefix
          result = false
        end
      end

      result
    end

    def bucket_exists?(args)
      bucket_prefix = args[:bucket_prefix]
      region = args[:region]

      bucket = "#{bucket_prefix}-#{region}"
      
      s3 ||= AWS::S3.new :config => @config,
                         :region => region

      if s3.get_bucket bucket
        @logger.debug "Bucket '#{bucket}' exists in '#{region}'."
        true
      else
        @logger.debug "Bucket '#{bucket}' does not exist in '#{region}'."
        false
      end
    end

    def domain_exists?
      domain = "heirloom_#{@name}"
      region = @config.metadata_region
      if sdb.domain_exists? domain
        @logger.debug "Domain '#{@name}' exists in '#{region}'."
        true
      else
        @logger.debug "Domain '#{@name}' does not exist in '#{region}'."
        false
      end
    end

    private

    def sdb
      @sdb ||= AWS::SimpleDB.new :config => @config
    end

  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
heirloom-0.12.7 lib/heirloom/archive/verifier.rb
heirloom-0.12.5 lib/heirloom/archive/verifier.rb
heirloom-0.12.4 lib/heirloom/archive/verifier.rb
heirloom-0.12.3 lib/heirloom/archive/verifier.rb
heirloom-0.12.2 lib/heirloom/archive/verifier.rb
heirloom-0.12.1 lib/heirloom/archive/verifier.rb
heirloom-0.12.0 lib/heirloom/archive/verifier.rb
heirloom-0.11.2 lib/heirloom/archive/verifier.rb
heirloom-0.11.1 lib/heirloom/archive/verifier.rb
heirloom-0.11.0 lib/heirloom/archive/verifier.rb
heirloom-0.11.0.beta.2 lib/heirloom/archive/verifier.rb
heirloom-0.11.0.beta.1 lib/heirloom/archive/verifier.rb
heirloom-0.10.1 lib/heirloom/archive/verifier.rb
heirloom-0.10.0 lib/heirloom/archive/verifier.rb
heirloom-0.9.0 lib/heirloom/archive/verifier.rb
heirloom-0.8.3 lib/heirloom/archive/verifier.rb
heirloom-0.8.2 lib/heirloom/archive/verifier.rb
heirloom-0.8.1 lib/heirloom/archive/verifier.rb
heirloom-0.8.0 lib/heirloom/archive/verifier.rb
heirloom-0.7.4 lib/heirloom/archive/verifier.rb