kitchen-ec2 3.11.1 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/aws/instance_generator.rb +12 -8
- data/lib/kitchen/driver/ec2.rb +29 -13
- data/lib/kitchen/driver/ec2_version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f76f759771ac4c8597dacffcf992e7d33fe1784c61be5ae6c84f00c77633b141
|
4
|
+
data.tar.gz: 324f1dd4944162dcd51bd6569dbfbabe9701ec58f6c1f8bf02ff96811bf48c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c946144405da7ec33817582d1115ac68dc76486307d86b8d7519a238d0aa0637d03152a0aad3b96fdfad25955e40eb96c513c862f7794f1ec4aeca3d029558
|
7
|
+
data.tar.gz: 136f94bcf170b07848f8bd7dd56d2918e38482003ece6d0da4029790651e60c1cd25ddd0e13749e6d90efdf6f6cf346f9d6d2eba17c45067db04ac8e4662558d
|
@@ -47,15 +47,19 @@ module Kitchen
|
|
47
47
|
vpc_id = nil
|
48
48
|
client = ::Aws::EC2::Client.new(region: config[:region])
|
49
49
|
if config[:subnet_id].nil? && config[:subnet_filter]
|
50
|
-
|
51
|
-
|
50
|
+
filters = [config[:subnet_filter]].flatten
|
51
|
+
|
52
|
+
r = { filters: [] }
|
53
|
+
filters.each do |subnet_filter|
|
54
|
+
r[:filters] <<
|
52
55
|
{
|
53
|
-
name: "tag:#{
|
54
|
-
values: [
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
name: "tag:#{subnet_filter[:tag]}",
|
57
|
+
values: [subnet_filter[:value]],
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
subnets = client.describe_subnets(r).subnets
|
62
|
+
raise "Subnets with tags '#{filters}' not found during security group creation" if subnets.empty?
|
59
63
|
|
60
64
|
# => Select the least-populated subnet if we have multiple matches
|
61
65
|
subnet = subnets.max_by { |s| s[:available_ip_address_count] }
|
data/lib/kitchen/driver/ec2.rb
CHANGED
@@ -265,9 +265,8 @@ module Kitchen
|
|
265
265
|
create_ec2_json(state) if /chef/i.match?(instance.provisioner.name)
|
266
266
|
debug("ec2:create '#{state[:hostname]}'")
|
267
267
|
rescue Exception => e
|
268
|
-
# Clean up any auto-created security groups or keys on the way out.
|
269
|
-
|
270
|
-
delete_key(state)
|
268
|
+
# Clean up the instance and any auto-created security groups or keys on the way out.
|
269
|
+
destroy(state)
|
271
270
|
raise "#{e.message} in the specified region #{config[:region]}. Please check this AMI is available in this region."
|
272
271
|
end
|
273
272
|
|
@@ -433,15 +432,21 @@ module Kitchen
|
|
433
432
|
else
|
434
433
|
# => Enable cascading through matching subnets
|
435
434
|
client = ::Aws::EC2::Client.new(region: config[:region])
|
436
|
-
|
437
|
-
|
435
|
+
|
436
|
+
filters = [config[:subnet_filter]].flatten
|
437
|
+
|
438
|
+
r = { filters: [] }
|
439
|
+
filters.each do |subnet_filter|
|
440
|
+
r[:filters] <<
|
438
441
|
{
|
439
|
-
name: "tag:#{
|
440
|
-
values: [
|
441
|
-
}
|
442
|
-
|
443
|
-
|
444
|
-
|
442
|
+
name: "tag:#{subnet_filter[:tag]}",
|
443
|
+
values: [subnet_filter[:value]],
|
444
|
+
}
|
445
|
+
end
|
446
|
+
|
447
|
+
subnets = client.describe_subnets(r).subnets
|
448
|
+
|
449
|
+
raise "Subnets with tags '#{filters}' not found!" if subnets.empty?
|
445
450
|
|
446
451
|
configs = subnets.map do |subnet|
|
447
452
|
new_config = config.clone
|
@@ -751,8 +756,19 @@ module Kitchen
|
|
751
756
|
|
752
757
|
subnets.first.vpc_id
|
753
758
|
elsif config[:subnet_filter]
|
754
|
-
|
755
|
-
|
759
|
+
filters = [config[:subnet_filter]].flatten
|
760
|
+
|
761
|
+
r = { filters: [] }
|
762
|
+
filters.each do |subnet_filter|
|
763
|
+
r[:filters] << {
|
764
|
+
name: "tag:#{subnet_filter[:tag]}",
|
765
|
+
values: [subnet_filter[:value]],
|
766
|
+
}
|
767
|
+
end
|
768
|
+
|
769
|
+
subnets = ec2.client.describe_subnets(r).subnets
|
770
|
+
|
771
|
+
raise "Subnets with tags '#{filters}' not found during security group creation" if subnets.empty?
|
756
772
|
|
757
773
|
subnets.first.vpc_id
|
758
774
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
|
-
rubygems_version: 3.2.
|
108
|
+
rubygems_version: 3.2.32
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: A Test Kitchen Driver for Amazon EC2
|