chef-provisioning-aws 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78ac497500f0226dd453d38b11672bf011912bd1
4
- data.tar.gz: 31375442837975f755e5950c651d64f9181cbd17
3
+ metadata.gz: 8104b43cd7f3e128af585cd5871d0fa7e04903b1
4
+ data.tar.gz: 28aba3488876b8765de799d9e4f13161a5e58545
5
5
  SHA512:
6
- metadata.gz: 9a8afd7e5dc451ef336d9ce4dd200d0ea92320cbabbf188f8ba138c3ffde45cea33a109b1900ca5a769a0143df4086a2a7585026e461de599a627c17501503cb
7
- data.tar.gz: a0c5c982882cdc52acd1fd373561b204fe573c763bc5bfcbc2f9b1feb4c86307ed61bfbf457999ff3f4b03d6eb1ba55bbc688e76f4e7fd80b71448a9409d89fa
6
+ metadata.gz: 586ff8458f4ddd1dcbb77d8f9dd3b2a248926abe12aaefdee427e1cb91261be4dea032317a1629520151e603b2cda4172e3d783588c15e2dc7a4ba8680701d59
7
+ data.tar.gz: 8d62b5421a9ffe4dcc5461554d3ffac456bc82502edf416f7a9c41324f0077061639d0cce68cc8008e024e5edd4a3aa39bce4ebea3fe2d3f25c0fad48b5eb637
@@ -17,6 +17,7 @@ class Chef::Provider::AwsAutoScalingGroup < Chef::Provisioning::AWSDriver::AWSPr
17
17
  options[:auto_scaling_group_name] = new_resource.name
18
18
  options[:launch_configuration_name] = new_resource.launch_configuration if new_resource.launch_configuration
19
19
  options[:load_balancer_names] = new_resource.load_balancers if new_resource.load_balancers
20
+ options[:vpc_zone_identifier] = [options.delete(:subnets)].flatten.join(",") if options[:subnets]
20
21
 
21
22
  aws_obj = new_resource.driver.auto_scaling_resource.create_group(options)
22
23
 
@@ -1,5 +1,6 @@
1
1
  require 'chef/provisioning/aws_driver/aws_provider'
2
2
  require 'chef/resource/aws_image'
3
+ require 'base64'
3
4
 
4
5
  class Chef::Provider::AwsLaunchConfiguration < Chef::Provisioning::AWSDriver::AWSProvider
5
6
  provides :aws_launch_configuration
@@ -13,6 +14,9 @@ class Chef::Provider::AwsLaunchConfiguration < Chef::Provisioning::AWSDriver::AW
13
14
  options[:launch_configuration_name] = new_resource.name if new_resource.name
14
15
  options[:image_id] = image_id
15
16
  options[:instance_type] = instance_type
17
+ if options[:user_data]
18
+ options[:user_data] = ensure_base64_encoded(options[:user_data])
19
+ end
16
20
 
17
21
  converge_by "create launch configuration #{new_resource.name} in #{region}" do
18
22
  new_resource.driver.auto_scaling_client.create_launch_configuration(options)
@@ -47,4 +51,15 @@ class Chef::Provider::AwsLaunchConfiguration < Chef::Provisioning::AWSDriver::AW
47
51
  end
48
52
  end
49
53
 
54
+ private
55
+
56
+ def ensure_base64_encoded(data)
57
+ begin
58
+ Base64.strict_decode64(data)
59
+ return data
60
+ rescue ArgumentError
61
+ return Base64.encode64(data)
62
+ end
63
+ end
64
+
50
65
  end
@@ -162,7 +162,7 @@ module AWSDriver
162
162
  def cloudsearch
163
163
  @cloudsearch ||= Aws::CloudSearch::Client.new(aws_config)
164
164
  end
165
-
165
+
166
166
  def self.canonicalize_url(driver_url, config)
167
167
  [ driver_url, config ]
168
168
  end
@@ -1400,7 +1400,7 @@ EOD
1400
1400
  instance ||= instance_for(machine_spec)
1401
1401
  sleep_time = 10
1402
1402
  transport = transport_for(machine_spec, machine_options, instance)
1403
- unless instance.state.name.eql?("running")
1403
+ unless instance.state.name.eql?("running") && transport.available?
1404
1404
  if action_handler.should_perform_actions
1405
1405
  action_handler.report_progress "waiting for #{machine_spec.name} (#{instance.id} on #{driver_url}) to be connectable (transport up and running) ..."
1406
1406
  max_wait_time = Chef::Config.chef_provisioning[:machine_max_wait_time] || 120
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Provisioning
3
3
  module AWSDriver
4
- VERSION = '3.0.1'
4
+ VERSION = '3.0.2'
5
5
  end
6
6
  end
7
7
  end
@@ -63,6 +63,27 @@ describe Chef::Resource::AwsAutoScalingGroup do
63
63
  'test_group_with_policy').and be_idempotent
64
64
  end
65
65
 
66
+ # test_public_subnet
67
+ context "when referencing a subnet" do
68
+ purge_all
69
+ setup_public_vpc
70
+ it "creates an aws_auto_scaling_group" do
71
+ expect_recipe {
72
+ aws_auto_scaling_group 'test_group' do
73
+ launch_configuration 'test_config'
74
+ # availability_zones ["#{driver.region}a"]
75
+ min_size 1
76
+ max_size 2
77
+ options({
78
+ subnets: 'test_public_subnet'
79
+ })
80
+ end
81
+ }.to create_an_aws_auto_scaling_group('test_group',
82
+ vpc_zone_identifier: test_public_subnet.aws_object.id
83
+ ).and be_idempotent
84
+ end
85
+ end
86
+
66
87
  it "creates aws_auto_scaling_group tags" do
67
88
  expect_recipe {
68
89
  aws_auto_scaling_group 'test_group_with_policy' do
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Resource::AwsLaunchConfiguration do
4
+ extend AWSSupport
5
+
6
+ when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
7
+ with_aws "when connected to AWS" do
8
+ let(:image_filters) {
9
+ {
10
+ filters: [
11
+ {
12
+ name: "image-type",
13
+ values: ["machine"]
14
+ },
15
+ {
16
+ name: "state",
17
+ values: ["available"]
18
+ },
19
+ {
20
+ name: "is-public",
21
+ values: ["true"]
22
+ },
23
+ {
24
+ name: "owner-alias",
25
+ values: ["amazon"]
26
+ }
27
+ ]
28
+ }
29
+ }
30
+
31
+ it "creates a minimum aws_launch_configuration" do
32
+ expect_recipe {
33
+ ami = driver.ec2_client.describe_images(image_filters).images[0].image_id
34
+ aws_launch_configuration "my-launch-configuration" do
35
+ image ami
36
+ instance_type 't2.micro'
37
+ end
38
+ }.to create_an_aws_launch_configuration("my-launch-configuration").and be_idempotent
39
+ end
40
+
41
+ it "accepts base64 encoded user data" do
42
+ expect_recipe {
43
+ ami = driver.ec2_client.describe_images(image_filters).images[0].image_id
44
+ aws_launch_configuration "my-launch-configuration" do
45
+ image ami
46
+ instance_type 't2.micro'
47
+ options({
48
+ user_data: Base64.encode64("echo 1")
49
+ })
50
+ end
51
+ }.to create_an_aws_launch_configuration("my-launch-configuration").and be_idempotent
52
+ end
53
+
54
+ it "accepts regular user data" do
55
+ expect_recipe {
56
+ ami = driver.ec2_client.describe_images(image_filters).images[0].image_id
57
+ aws_launch_configuration "my-launch-configuration" do
58
+ image ami
59
+ instance_type 't2.micro'
60
+ options({
61
+ user_data: "echo 1"
62
+ })
63
+ end
64
+ }.to create_an_aws_launch_configuration("my-launch-configuration").and be_idempotent
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -1,19 +1,21 @@
1
1
  example_id | status | run_time |
2
2
  --------------------------------------------------------------------- | ------- | ---------------------- |
3
- ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:1] | failed | 0.00001 seconds |
4
- ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:2] | failed | 0.00001 seconds |
5
- ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:3] | failed | 0 seconds |
6
- ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:4:1] | failed | 0 seconds |
7
- ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:4:2] | failed | 0 seconds |
3
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:1] | passed | 16.8 seconds |
4
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:2] | passed | 2 minutes 36.1 seconds |
5
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:3:1] | passed | 17.59 seconds |
6
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:4] | passed | 2 minutes 35.7 seconds |
7
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:5:1] | passed | 0.93488 seconds |
8
+ ./spec/integration/aws_auto_scaling_group_spec.rb[1:1:1:5:2] | passed | 0.94444 seconds |
8
9
  ./spec/integration/aws_cache_subnet_group_spec.rb[1:1:1:1] | passed | 1.37 seconds |
9
10
  ./spec/integration/aws_cloudsearch_domain_spec.rb[1:1:1:1] | passed | 3.45 seconds |
10
11
  ./spec/integration/aws_cloudsearch_domain_spec.rb[1:1:1:2] | passed | 0.16053 seconds |
11
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:1] | passed | 1.19 seconds |
12
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:2] | passed | 2.44 seconds |
13
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:3:1] | passed | 2.24 seconds |
14
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:1] | passed | 2.47 seconds |
15
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:2] | passed | 1.2 seconds |
16
- ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:3] | passed | 1.15 seconds |
12
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:1] | passed | 2.55 seconds |
13
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:2] | passed | 2.84 seconds |
14
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:3:1] | unknown | |
15
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:1] | passed | 3.29 seconds |
16
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:2] | unknown | |
17
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:4:3] | unknown | |
18
+ ./spec/integration/aws_cloudwatch_alarm_spec.rb[1:1:1:5:1] | failed | 3.92 seconds |
17
19
  ./spec/integration/aws_dhcp_options_spec.rb[1:1:1:1] | passed | 1.52 seconds |
18
20
  ./spec/integration/aws_dhcp_options_spec.rb[1:1:1:2] | passed | 1.95 seconds |
19
21
  ./spec/integration/aws_dhcp_options_spec.rb[1:1:1:3:1] | passed | 1.22 seconds |
@@ -59,6 +61,9 @@ example_id | status
59
61
  ./spec/integration/aws_internet_gateway_spec.rb[1:1:1:5:3:2] | passed | 1.95 seconds |
60
62
  ./spec/integration/aws_internet_gateway_spec.rb[1:1:1:5:4:1] | passed | 4.33 seconds |
61
63
  ./spec/integration/aws_key_pair_spec.rb[1:1:1:1] | passed | 1.68 seconds |
64
+ ./spec/integration/aws_launch_configuration_spec.rb[1:1:1:1] | passed | 22.62 seconds |
65
+ ./spec/integration/aws_launch_configuration_spec.rb[1:1:1:2] | passed | 21.86 seconds |
66
+ ./spec/integration/aws_launch_configuration_spec.rb[1:1:1:3] | passed | 22.12 seconds |
62
67
  ./spec/integration/aws_nat_gateway_spec.rb[1:1:1:1:1] | passed | 2 minutes 53 seconds |
63
68
  ./spec/integration/aws_nat_gateway_spec.rb[1:1:1:2:1:1] | passed | 43.61 seconds |
64
69
  ./spec/integration/aws_network_acl_spec.rb[1:1:1:1] | passed | 2.35 seconds |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Ball
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-provisioning
@@ -219,6 +219,7 @@ files:
219
219
  - spec/integration/aws_iam_role_spec.rb
220
220
  - spec/integration/aws_internet_gateway_spec.rb
221
221
  - spec/integration/aws_key_pair_spec.rb
222
+ - spec/integration/aws_launch_configuration_spec.rb
222
223
  - spec/integration/aws_nat_gateway_spec.rb
223
224
  - spec/integration/aws_network_acl_spec.rb
224
225
  - spec/integration/aws_network_interface_spec.rb