Class: OpsPreflight::OpsWorks::FetchEnvironment
- Defined in:
- lib/ops_preflight/ops_works/fetch_environment.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#environment ⇒ Object
Returns the value of attribute environment.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(environment, region, stack_name, app_name) ⇒ FetchEnvironment
constructor
A new instance of FetchEnvironment.
Constructor Details
#initialize(environment, region, stack_name, app_name) ⇒ FetchEnvironment
Returns a new instance of FetchEnvironment.
11 12 13 14 15 16 |
# File 'lib/ops_preflight/ops_works/fetch_environment.rb', line 11 def initialize(environment, region, stack_name, app_name) super region, stack_name @environment = environment @app_name = app_name end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
8 9 10 |
# File 'lib/ops_preflight/ops_works/fetch_environment.rb', line 8 def app_name @app_name end |
#environment ⇒ Object
Returns the value of attribute environment.
9 10 11 |
# File 'lib/ops_preflight/ops_works/fetch_environment.rb', line 9 def environment @environment end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ops_preflight/ops_works/fetch_environment.rb', line 18 def call resp = opsworks.describe_stacks(:stack_ids => [stack_id]) require 'multi_json' json = MultiJson.load(resp[:stacks].first[:custom_json]) File.open("config/application.yml", 'wb') do |f| f.write json['env_vars'][app_name].to_yaml end end |