Module: EY::Metadata::Insider

Defined in:
lib/engineyard-metadata/insider.rb

Overview

This gets pulled in when you’re running directly on a cloud instance.

Constant Summary collapse

DELEGATED_TO_AMAZON_EC2_API =
%w{
  present_instance_id
  present_security_group
}
DELEGATED_TO_CHEF_DNA =
METHODS - DELEGATED_TO_AMAZON_EC2_API

Instance Method Summary collapse

Instance Method Details

#amazon_ec2_apiObject

An adapter that reads from Amazon’s EC2 API.



35
36
37
# File 'lib/engineyard-metadata/insider.rb', line 35

def amazon_ec2_api
  @amazon_ec2_api ||= AmazonEc2Api.new
end

#app_nameObject

Raises:

  • (RuntimeError)


39
40
41
42
43
44
45
46
47
48
# File 'lib/engineyard-metadata/insider.rb', line 39

def app_name
  return @app_name if @app_name.is_a? String
  if ENV['EY_APP_NAME']
    @app_name = ENV['EY_APP_NAME']
  elsif Dir.pwd =~ %r{/data/([^/]+)/current} or Dir.pwd =~ %r{/data/([^/]+)/releases}
    @app_name = $1
  end
  raise RuntimeError, "[engineyard-metadata gem] Please set EY.metadata.app_name= or set ENV['EY_APP_NAME']" unless @app_name.to_s.strip.length > 0
  @app_name
end

#chef_dnaObject

An adapter that reads from the EngineYard AppCloud /etc/chef/dna.json file.



30
31
32
# File 'lib/engineyard-metadata/insider.rb', line 30

def chef_dna
  @chef_dna ||= ChefDna.new
end

#environment_namesObject

You can’t get the list of environment names while you’re on the instances themselves.

Raises:



25
26
27
# File 'lib/engineyard-metadata/insider.rb', line 25

def environment_names
  raise CannotGetFromHere
end