Sha256: 13713704ad2eeeeadc9fccd3d9dc2bd0fe8a18d1d39326e4a8e3df10cc483ea5

Contents?: true

Size: 868 Bytes

Versions: 3

Compression:

Stored size: 868 Bytes

Contents

module EY
  module Metadata
    # This gets pulled in when you're running directly on a cloud instance.
    module Insider
      DELEGATED_TO_AMAZON_EC2_API = %w{
        present_instance_id
        present_security_group
      }
    
      DELEGATED_TO_CHEF_DNA = KEYS - DELEGATED_TO_AMAZON_EC2_API

      DELEGATED_TO_AMAZON_EC2_API.each do |name|
        define_method name do
          amazon_ec2_api.send name
        end
      end

      DELEGATED_TO_CHEF_DNA.each do |name|
        define_method name do
          chef_dna.send name
        end
      end
      
      # An adapter that reads from the EngineYard AppCloud /etc/chef/dna.json file.
      def chef_dna
        @chef_dna ||= ChefDna.new
      end

      # An adapter that reads from Amazon's EC2 API.
      def amazon_ec2_api
        @amazon_ec2_api ||= AmazonEc2Api.new
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
engineyard-metadata-0.0.7 lib/engineyard-metadata/insider.rb
engineyard-metadata-0.0.6 lib/engineyard-metadata/insider.rb
engineyard-metadata-0.0.5 lib/engineyard-metadata/insider.rb