chef-provisioning-aws 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/provisioning/aws_driver/driver.rb +9 -4
- data/lib/chef/provisioning/aws_driver/version.rb +1 -1
- data/lib/chef/resource/aws_ebs_volume.rb +1 -1
- data/lib/chef/resource/aws_route53_hosted_zone.rb +1 -1
- data/lib/chef/resource/aws_route53_record_set.rb +3 -2
- data/lib/chef/resource/aws_subnet.rb +1 -1
- data/lib/chef/resource/aws_vpc.rb +1 -1
- data/spec/integration/aws_route53_hosted_zone_spec.rb +43 -0
- data/spec/integration/load_balancer_spec.rb +27 -1
- data/spec/integration/machine_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8a5c0aed646021b3eaf7a62862172f5c7fe2de7
|
4
|
+
data.tar.gz: 484a6c780d5194f447e1929a234a73343a0ac651
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbb4e40771fdac35dbbf3cca8a60a09f2f0860d57595fb8078111f6081c6a0dd64f08fa64a453442d242613f6b7d86a526cc9b1a5b678422a8785bd17cd05cbe
|
7
|
+
data.tar.gz: 8ea07beb763fc0997070a9b61e2d7c45e66a4977bf6800d253ef9c1a146199562083854a52a4982abb76a4a069878a7b693c7dcc7a41e48be64f680a6bfadcb1
|
@@ -340,8 +340,8 @@ module AWSDriver
|
|
340
340
|
elsif ! server_certificate_eql?(listener.server_certificate,
|
341
341
|
server_cert_from_spec(desired_listener))
|
342
342
|
# Server certificate is mutable - if no immutable changes required a full recreate, update cert
|
343
|
-
perform_action.call(" update server certificate from #{listener.server_certificate} to #{desired_listener
|
344
|
-
listener.server_certificate = desired_listener
|
343
|
+
perform_action.call(" update server certificate from #{listener.server_certificate} to #{server_cert_from_spec(desired_listener)}") do
|
344
|
+
listener.server_certificate = server_cert_from_spec(desired_listener)
|
345
345
|
end
|
346
346
|
end
|
347
347
|
|
@@ -356,7 +356,7 @@ module AWSDriver
|
|
356
356
|
updates << " set protocol to #{listener[:protocol].inspect}"
|
357
357
|
updates << " set instance port to #{listener[:instance_port].inspect}"
|
358
358
|
updates << " set instance protocol to #{listener[:instance_protocol].inspect}"
|
359
|
-
updates << " set server certificate to #{listener
|
359
|
+
updates << " set server certificate to #{server_cert_from_spec(listener)}" if server_cert_from_spec(listener)
|
360
360
|
perform_action.call(updates) do
|
361
361
|
actual_elb.listeners.create(listener)
|
362
362
|
end
|
@@ -1163,7 +1163,12 @@ EOD
|
|
1163
1163
|
|
1164
1164
|
#Enable pty by default
|
1165
1165
|
options[:ssh_pty_enable] = true
|
1166
|
-
|
1166
|
+
|
1167
|
+
if machine_spec.reference.has_key?('ssh_gateway')
|
1168
|
+
options[:ssh_gateway] = machine_spec.reference['ssh_gateway']
|
1169
|
+
elsif machine_options[:ssh_gateway]
|
1170
|
+
options[:ssh_gateway] = machine_options[:ssh_gateway]
|
1171
|
+
end
|
1167
1172
|
|
1168
1173
|
Chef::Provisioning::Transport::SSH.new(remote_host, username, ssh_options, options, config)
|
1169
1174
|
end
|
@@ -20,7 +20,7 @@ class Chef::Resource::AwsEbsVolume < Chef::Provisioning::AWSDriver::AWSResourceW
|
|
20
20
|
attribute :device, kind_of: String
|
21
21
|
|
22
22
|
attribute :volume_id, kind_of: String, aws_id_attribute: true, default: lazy {
|
23
|
-
name =~ /^vol-[a-f0-9]{8}$/ ? name : nil
|
23
|
+
name =~ /^vol-(?:[a-f0-9]{8}|[a-f0-9]{17})$/ ? name : nil
|
24
24
|
}
|
25
25
|
|
26
26
|
def aws_object
|
@@ -126,7 +126,7 @@ class Chef::Provider::AwsRoute53HostedZone < Chef::Provisioning::AWSDriver::AWSP
|
|
126
126
|
if record_set_resources
|
127
127
|
populate_zone_info(record_set_resources, zone)
|
128
128
|
|
129
|
-
change_list = record_set_resources.map { |rs| rs.to_aws_change_struct(
|
129
|
+
change_list = record_set_resources.map { |rs| rs.to_aws_change_struct(UPDATE) }
|
130
130
|
|
131
131
|
new_resource.driver.route53_client.change_resource_record_sets(hosted_zone_id: new_resource.aws_route53_zone_id,
|
132
132
|
change_batch: {
|
@@ -80,10 +80,11 @@ class Chef::Resource::AwsRoute53RecordSet < Chef::Provisioning::AWSDriver::Super
|
|
80
80
|
raise(::Chef::Exceptions::ValidationFailed,
|
81
81
|
"CNAME records may only have a single value (a hostname).")
|
82
82
|
|
83
|
-
|
83
|
+
|
84
|
+
when "SOA", "NS", "TXT", "PTR", "AAAA", "SPF"
|
84
85
|
true
|
85
86
|
else
|
86
|
-
raise ArgumentError, "Argument '#{type}' must be one of #{%w(A MX SRV CNAME TXT PTR AAAA SPF)}"
|
87
|
+
raise ArgumentError, "Argument '#{type}' must be one of #{%w(SOA NS A MX SRV CNAME TXT PTR AAAA SPF)}"
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
@@ -76,7 +76,7 @@ class Chef::Resource::AwsSubnet < Chef::Provisioning::AWSDriver::AWSResourceWith
|
|
76
76
|
#
|
77
77
|
# By default, an implicit association with the main route table is made (`:default_to_main`)
|
78
78
|
#
|
79
|
-
attribute :route_table#, kind_of: [ String, AwsRouteTable,
|
79
|
+
attribute :route_table#, kind_of: [ String, AwsRouteTable, ::Aws::EC2::RouteTable ], equal_to: [ :default_to_main ]
|
80
80
|
|
81
81
|
#
|
82
82
|
# The Network ACL to associate with this subnet. Subnets may only
|
@@ -79,7 +79,7 @@ class Chef::Resource::AwsVpc < Chef::Provisioning::AWSDriver::AWSResourceWithEnt
|
|
79
79
|
# - An actual `aws_route_table` resource.
|
80
80
|
# - An AWS `route_table` object.
|
81
81
|
#
|
82
|
-
attribute :main_route_table, kind_of: [ String, AwsRouteTable,
|
82
|
+
attribute :main_route_table, kind_of: [ String, AwsRouteTable, ::Aws::EC2::RouteTable ]
|
83
83
|
|
84
84
|
#
|
85
85
|
# The routes for the main route table.
|
@@ -384,6 +384,17 @@ describe Chef::Resource::AwsRoute53HostedZone do
|
|
384
384
|
resource_records: [{ value: "10 50 8889 chef-server.example.com" },
|
385
385
|
{ value: "20 70 80 narf.net" }],
|
386
386
|
},
|
387
|
+
soa: {
|
388
|
+
name: "feegle.com.",
|
389
|
+
type: "SOA",
|
390
|
+
resource_records: [{ value: "ns-1641.awsdns-13.co.uk. awsdns-hostmaster.amazon.com. 2 7200 900 1209600 86400"}],
|
391
|
+
},
|
392
|
+
ns: {
|
393
|
+
name: "feegle.com.",
|
394
|
+
type: "NS",
|
395
|
+
resource_records: [{ value: "ns1.amazon.com." },
|
396
|
+
{ value: "ns2.amazon.org." }],
|
397
|
+
},
|
387
398
|
}}
|
388
399
|
|
389
400
|
it "handles CNAME records" do
|
@@ -482,6 +493,38 @@ describe Chef::Resource::AwsRoute53HostedZone do
|
|
482
493
|
}.to raise_error(Chef::Exceptions::ValidationFailed, /MX records must have a priority and mail server/)
|
483
494
|
end
|
484
495
|
|
496
|
+
it "handles SOA records" do
|
497
|
+
expect_recipe {
|
498
|
+
aws_route53_hosted_zone "feegle.com" do
|
499
|
+
record_sets {
|
500
|
+
aws_route53_record_set "SOA-host" do
|
501
|
+
rr_name "feegle.com."
|
502
|
+
type "SOA"
|
503
|
+
ttl 300
|
504
|
+
resource_records ["ns-1641.awsdns-13.co.uk. awsdns-hostmaster.amazon.com. 2 7200 900 1209600 86400"]
|
505
|
+
end
|
506
|
+
}
|
507
|
+
end
|
508
|
+
}.to create_an_aws_route53_hosted_zone("feegle.com",
|
509
|
+
resource_record_sets: [ {}, expected[:soa] ]).and be_idempotent
|
510
|
+
end
|
511
|
+
|
512
|
+
it "handles NS records" do
|
513
|
+
expect_recipe {
|
514
|
+
aws_route53_hosted_zone "feegle.com" do
|
515
|
+
record_sets {
|
516
|
+
aws_route53_record_set "NS-host" do
|
517
|
+
rr_name "feegle.com."
|
518
|
+
type "NS"
|
519
|
+
ttl 300
|
520
|
+
resource_records %w[ns1.amazon.com. ns2.amazon.org.]
|
521
|
+
end
|
522
|
+
}
|
523
|
+
end
|
524
|
+
}.to create_an_aws_route53_hosted_zone("feegle.com",
|
525
|
+
resource_record_sets: [ expected[:ns], {} ]).and be_idempotent
|
526
|
+
end
|
527
|
+
|
485
528
|
# we don't validate TXT values:
|
486
529
|
# http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#TXTFormat
|
487
530
|
it "handles TXT records" do
|
@@ -16,7 +16,7 @@ describe Chef::Resource::LoadBalancer do
|
|
16
16
|
recursive_delete true
|
17
17
|
end
|
18
18
|
|
19
|
-
cert_string = "-----BEGIN CERTIFICATE-----\
|
19
|
+
cert_string = "-----BEGIN CERTIFICATE-----\nMIIDlDCCAnygAwIBAgIJAOR3PCV+XjkpMA0GCSqGSIb3DQEBBQUAMDoxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMRYwFAYDVQQKEw1DaGVmIFNvZnR3\nYXJlMB4XDTE2MDgwMzE2MTUwNVoXDTQzMTIyMDE2MTUwNVowOjELMAkGA1UEBhMC\nVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxFjAUBgNVBAoTDUNoZWYgU29mdHdhcmUw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPiAXE1LPDDBithNM4I1VA\nv9qCkheZAoq2QTv5Sn7Bo51JHaJm+Bzh+jACpBDl21W26vosQDYsOUsgsT7syGUH\nE9zdX32WGLmn8+94YI8juT2xhPSI8nCKq9b7+cKj3dCg2lRQOBvpalP9EQ0URKf3\n2dMTk2PE3HnrRqpLEA8dOiAkTPfALxzqZBCgA065fM1vjXC84JQjtOS7voBD24QI\nVSO1ilenHySiZpgA+3DOvzssZ1LKwTvmuhqB7CzYzMAmAYbXqhQGwnNPjkyUjJCi\ns3cCOhnd/N7qSik6EBZ5hQzrWvBOrsm0te0Eb/3InNN395ZTxzhxIrzN4/Hjxf1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pUnup1gMxATJZm4KelKvtKz2\nU1MXpc1i395e+E+tjNAQg0JcBmwkHOMl8c/oAESWPxi11ezalGtUXjIgjBkqqNUE\n/uFqRpNFGwI09JolIqhBTgPWFq6MuuPDJ9IIGJZDQoGEBKmu0k2r\n-----END RSA PRIVATE KEY-----"
|
21
21
|
|
22
22
|
aws_server_certificate "load_balancer_cert" do
|
@@ -24,6 +24,11 @@ describe Chef::Resource::LoadBalancer do
|
|
24
24
|
private_key private_key_string
|
25
25
|
end
|
26
26
|
|
27
|
+
aws_server_certificate "load_balancer_cert_2" do
|
28
|
+
certificate_body cert_string
|
29
|
+
private_key private_key_string
|
30
|
+
end
|
31
|
+
|
27
32
|
it "creates a load_balancer with the maximum attributes" do
|
28
33
|
expect_recipe {
|
29
34
|
load_balancer 'test-load-balancer' do
|
@@ -173,6 +178,13 @@ describe Chef::Resource::LoadBalancer do
|
|
173
178
|
:protocol => :http,
|
174
179
|
:instance_port => 80,
|
175
180
|
:instance_protocol => :http,
|
181
|
+
},
|
182
|
+
{
|
183
|
+
:port => 8443,
|
184
|
+
:protocol => :https,
|
185
|
+
:instance_port => 80,
|
186
|
+
:instance_protocol => :http,
|
187
|
+
:ssl_certificate_id => load_balancer_cert.aws_object.arn
|
176
188
|
}],
|
177
189
|
subnets: ["test_public_subnet"],
|
178
190
|
security_groups: ["test_security_group"],
|
@@ -219,6 +231,13 @@ describe Chef::Resource::LoadBalancer do
|
|
219
231
|
:instance_port => 8080,
|
220
232
|
:instance_protocol => :http,
|
221
233
|
:ssl_certificate_id => load_balancer_cert.aws_object.arn
|
234
|
+
},
|
235
|
+
{
|
236
|
+
:port => 8443,
|
237
|
+
:protocol => :https,
|
238
|
+
:instance_port => 80,
|
239
|
+
:instance_protocol => :http,
|
240
|
+
:ssl_certificate_id => load_balancer_cert_2.aws_object.arn
|
222
241
|
}],
|
223
242
|
subnets: ["test_public_subnet2"],
|
224
243
|
security_groups: ["test_security_group2"],
|
@@ -262,6 +281,13 @@ describe Chef::Resource::LoadBalancer do
|
|
262
281
|
:instance_port => 8080,
|
263
282
|
:instance_protocol => :http,
|
264
283
|
:server_certificate => {arn: load_balancer_cert.aws_object.arn}
|
284
|
+
},
|
285
|
+
{
|
286
|
+
:port => 8443,
|
287
|
+
:protocol => :https,
|
288
|
+
:instance_port => 80,
|
289
|
+
:instance_protocol => :http,
|
290
|
+
:server_certificate => {arn: load_balancer_cert_2.aws_object.arn}
|
265
291
|
}],
|
266
292
|
subnets: [test_public_subnet2.aws_object],
|
267
293
|
security_groups: [test_security_group2.aws_object],
|
@@ -53,6 +53,33 @@ describe Chef::Resource::Machine do
|
|
53
53
|
# The non-idempotence is that it runs chef again, not that it unecessarily modifies the aws_object
|
54
54
|
end
|
55
55
|
|
56
|
+
it "successfully converges a machine with custom ssh options", :super_slow do
|
57
|
+
expect_recipe {
|
58
|
+
machine 'test_machine' do
|
59
|
+
machine_options bootstrap_options: {
|
60
|
+
subnet_id: 'test_public_subnet',
|
61
|
+
key_name: 'test_key_pair'
|
62
|
+
},
|
63
|
+
ssh_username: "ubuntu", # Username to use for ssh and WinRM
|
64
|
+
ssh_options: { # a list of options to Net::SSH.start
|
65
|
+
:auth_methods => [ 'publickey' ], # DEFAULT
|
66
|
+
:keys_only => true, # DEFAULT
|
67
|
+
:forward_agent => true, # you may want your ssh-agent to be available on your provisioned machines
|
68
|
+
:remote_forwards => [
|
69
|
+
# Give remote host access to private git server
|
70
|
+
{:remote_port => 2222, :local_host => 'git.example.com', :local_port => 22,},
|
71
|
+
],
|
72
|
+
# You can send net-ssh log info to the Chef::Log if you are having
|
73
|
+
# trouble with ssh.
|
74
|
+
:logger => Chef::Log,
|
75
|
+
}
|
76
|
+
end
|
77
|
+
}.to create_an_aws_instance('test_machine'
|
78
|
+
)#.and be_idempotent
|
79
|
+
# Bug - machine resource with :converge action isn't idempotent
|
80
|
+
# The non-idempotence is that it runs chef again, not that it unecessarily modifies the aws_object
|
81
|
+
end
|
82
|
+
|
56
83
|
it "machine with source_dest_check false creates a machine with no source dest check", :super_slow do
|
57
84
|
expect_recipe {
|
58
85
|
machine 'test_machine' do
|
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: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-provisioning
|