Class: EY::Metadata::Insider
- Inherits:
-
EY::Metadata
- Object
- EY::Metadata
- 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 - instance_methods.map { |m| m.to_s } - DELEGATED_TO_AMAZON_EC2_API
Constants inherited from EY::Metadata
DEFAULT_IDENTIFIER, METHODS, VERSION
Instance Method Summary collapse
-
#amazon_ec2_api ⇒ Object
An adapter that reads from Amazon’s EC2 API.
- #app_name ⇒ Object
-
#chef_dna ⇒ Object
An adapter that reads from the EngineYard AppCloud /etc/chef/dna.json file.
-
#environment_names ⇒ Object
You can’t get the list of environment names while you’re on the instances themselves.
Methods inherited from EY::Metadata
Instance Method Details
#amazon_ec2_api ⇒ Object
An adapter that reads from Amazon’s EC2 API.
16 17 18 |
# File 'lib/engineyard-metadata/insider.rb', line 16 def amazon_ec2_api @amazon_ec2_api ||= AmazonEc2Api.new end |
#app_name ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/engineyard-metadata/insider.rb', line 20 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_dna ⇒ Object
An adapter that reads from the EngineYard AppCloud /etc/chef/dna.json file.
11 12 13 |
# File 'lib/engineyard-metadata/insider.rb', line 11 def chef_dna @chef_dna ||= ChefDna.new end |
#environment_names ⇒ Object
You can’t get the list of environment names while you’re on the instances themselves.
6 7 8 |
# File 'lib/engineyard-metadata/insider.rb', line 6 def environment_names raise CannotGetFromHere end |