eb_deployer 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,14 +14,15 @@ module EbDeployer
14
14
  def provision(resources)
15
15
  resources = symbolize_keys(resources)
16
16
  template = File.read(resources[:template])
17
- outputs = resources[:outputs] || {}
18
- transforms = resources[:transforms] || {}
19
17
  capabilities = resources[:capabilities] || []
20
18
  params = resources[:inputs] || resources[:parameters] || {}
21
-
22
19
  stack_exists? ? update_stack(template, params, capabilities) : create_stack(template, params, capabilities)
23
20
  wait_for_stack_op_terminate
21
+ end
24
22
 
23
+ def transform_outputs(resources)
24
+ outputs = resources[:outputs] || {}
25
+ transforms = resources[:transforms] || {}
25
26
  transform_output_to_settings(convert_to_transforms(outputs).merge(transforms))
26
27
  end
27
28
 
@@ -1,3 +1,3 @@
1
1
  module EbDeployer
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
data/lib/eb_deployer.rb CHANGED
@@ -184,8 +184,9 @@ module EbDeployer
184
184
  :smoke_test => smoke_test,
185
185
  :phoenix_mode => phoenix_mode)
186
186
 
187
- if !skip_resource && resources = opts[:resources]
188
- env_settings += cf.provision(resources)
187
+ if resources = opts[:resources]
188
+ cf.provision(resources) unless skip_resource
189
+ env_settings += cf.transform_outputs(resources)
189
190
  end
190
191
 
191
192
  application.create_version(version_label, opts[:package])
@@ -9,20 +9,23 @@ class CloudFormationProvisionerTest < Minitest::Test
9
9
 
10
10
 
11
11
  def test_convert_inputs_as_params_to_cf
12
- @provisioner.provision(:template => @template,
13
- :inputs => { 'Foo' => 'Bar' })
12
+ resources = { :template => @template, :inputs => { 'Foo' => 'Bar' } }
13
+ @provisioner.provision(resources)
14
14
 
15
15
  assert_equal({ 'Foo' => 'Bar' }, @cf.stack_config("myresources")[:parameters])
16
16
  end
17
17
 
18
18
  def test_transform_to_eb_settings
19
- settings = @provisioner.provision(:template => @template,
20
- :outputs => {
21
- 'S' => {
22
- 'namespace' => "foo",
23
- "option_name" => "bar"
24
- }
25
- })
19
+ resources = { :template => @template,
20
+ :outputs => {
21
+ 'S' => {
22
+ 'namespace' => "foo",
23
+ "option_name" => "bar"
24
+ }
25
+ }}
26
+
27
+ @provisioner.provision(resources)
28
+ settings = @provisioner.transform_outputs(resources)
26
29
  assert_equal [{'namespace' => 'foo', 'option_name' => 'bar', 'value' => 'value of S'}], settings
27
30
  end
28
31
  end
data/test/deploy_test.rb CHANGED
@@ -219,6 +219,27 @@ class DeployTest < Minitest::Test
219
219
  assert_equal(2, @cf_driver.stack_config('simple-production')[:parameters]['a'])
220
220
  end
221
221
 
222
+ def test_should_still_query_output_to_set_eb_options_even_skip_resources_update_is_specified
223
+ cf_template = temp_file(JSON.dump({'Resources' => {'R1' => {}},
224
+ 'Outputs' => {'O1' => {}, 'O2' => {}}}))
225
+ deploy(:application => 'simple', :environment => "production",
226
+ :resources => {
227
+ :template => cf_template
228
+ })
229
+
230
+ deploy(:application => 'simple', :environment => "production",
231
+ :skip_resource_stack_update => true,
232
+ :resources => {
233
+ :template => cf_template,
234
+ :transforms => {
235
+ 'O2' => lambda { |v| {:namespace => 'aws.foo', :option_name => 'o2', :value => "transformed " + v} }
236
+ }
237
+ })
238
+
239
+ assert @eb_driver.environment_settings('simple', eb_envname('simple', 'production')).
240
+ include?({:namespace => 'aws.foo', :option_name => 'o2', :value => 'transformed value of O2'})
241
+ end
242
+
222
243
 
223
244
  def test_set_s3_bucket_name_on_deployment
224
245
  deploy(:application => 'simple',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: