knife-ec2 1.0.32 → 1.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/ec2_server_create.rb +14 -6
- data/lib/chef/knife/helpers/ec2_base.rb +7 -3
- data/lib/knife-ec2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50ee04d6ee29701c1dd9b40b23da36cb22628fb1e29e40a33460581ec2ddff6b
|
4
|
+
data.tar.gz: 849825bbda6123485edaf4c2a9db8253a5c57ab742fbb8253078aec8f86ff39d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ef3159b6987c5efddbd4ccdf7cb3bb526ea90e9ae9243e319e953b1c9ea0d5d799496e3217c4b485b7987329c1ad0eba85e47e7e673398f36050305f57178f7
|
7
|
+
data.tar.gz: 33e7f8d5854e2cb8cca7c44060adcbeb4b56917bc9489c6b5fa308c7315f7818fbd41ebc71dff4e9939ee3147b3123728f4dbd665f1ecec070a9af8738c4f21c
|
@@ -623,7 +623,7 @@ class Chef
|
|
623
623
|
if config[:associate_eip]
|
624
624
|
eips = ec2_connection.describe_addresses.addresses.collect { |addr| addr if addr.domain == eip_scope }.compact
|
625
625
|
|
626
|
-
unless eips.detect { |addr| addr.public_ip == config[:associate_eip] && addr.instance_id.nil? }
|
626
|
+
unless eips.detect { |addr| addr.public_ip == config[:associate_eip] && (addr.instance_id.nil? || addr.instance_id.empty?) }
|
627
627
|
ui.error("Elastic IP requested is not available.")
|
628
628
|
exit 1
|
629
629
|
end
|
@@ -858,7 +858,6 @@ class Chef
|
|
858
858
|
attributes = {
|
859
859
|
image_id: config_value(:image),
|
860
860
|
instance_type: config_value(:flavor),
|
861
|
-
groups: config[:security_groups],
|
862
861
|
key_name: config_value(:ssh_key_name),
|
863
862
|
max_count: 1,
|
864
863
|
min_count: 1,
|
@@ -878,6 +877,8 @@ class Chef
|
|
878
877
|
network_attrs[:groups] = config_value(:security_group_ids) if !!config_value(:security_group_ids)
|
879
878
|
network_attrs[:private_ip_address] = config_value(:private_ip_address)
|
880
879
|
network_attrs[:associate_public_ip_address] = config_value(:associate_public_ip)
|
880
|
+
else
|
881
|
+
attributes[:security_groups] = config[:security_groups]
|
881
882
|
end
|
882
883
|
|
883
884
|
if network_attrs.length > 0
|
@@ -1199,10 +1200,17 @@ class Chef
|
|
1199
1200
|
end
|
1200
1201
|
|
1201
1202
|
def associate_address(elastic_ip)
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1203
|
+
if vpc_mode?
|
1204
|
+
ec2_connection.associate_address({
|
1205
|
+
allocation_id: elastic_ip.allocation_id,
|
1206
|
+
instance_id: server.id,
|
1207
|
+
})
|
1208
|
+
else
|
1209
|
+
ec2_connection.associate_address({
|
1210
|
+
public_ip: elastic_ip.public_ip,
|
1211
|
+
instance_id: server.id,
|
1212
|
+
})
|
1213
|
+
end
|
1206
1214
|
end
|
1207
1215
|
|
1208
1216
|
def validate_nics!
|
@@ -100,6 +100,10 @@ class Chef
|
|
100
100
|
@ec2_connection ||= Aws::EC2::Client.new(connection_string)
|
101
101
|
end
|
102
102
|
|
103
|
+
def vpc_mode?
|
104
|
+
!!config_value(:subnet_id)
|
105
|
+
end
|
106
|
+
|
103
107
|
def fetch_ami(image_id)
|
104
108
|
return nil unless image_id
|
105
109
|
|
@@ -147,7 +151,7 @@ class Chef
|
|
147
151
|
server_data[id] = server_obj.instances[0].send(id)
|
148
152
|
end
|
149
153
|
server_data["availability_zone"] = server_obj.instances[0].placement.availability_zone
|
150
|
-
server_data["groups"] = server_obj.groups.map(&:
|
154
|
+
server_data["groups"] = server_obj.groups.map(&:group_name) unless vpc_mode?
|
151
155
|
server_data["iam_instance_profile"] = ( server_obj.instances[0].iam_instance_profile.nil? ? nil : server_obj.instances[0].iam_instance_profile.arn[%r{instance-profile/(.*)}] )
|
152
156
|
server_data["id"] = server_data["instance_id"]
|
153
157
|
|
@@ -157,8 +161,8 @@ class Chef
|
|
157
161
|
server_data["security_groups"] = server_obj.instances[0].security_groups.map(&:group_name)
|
158
162
|
server_data["security_group_ids"] = server_obj.instances[0].security_groups.map(&:group_id)
|
159
163
|
server_data["state"] = server_obj.instances[0].state.name
|
160
|
-
server_data["subnet_id"] = server_obj.instances[0].network_interfaces[0].subnet_id
|
161
|
-
server_data["source_dest_check"] = server_obj.instances[0].network_interfaces[0].source_dest_check
|
164
|
+
server_data["subnet_id"] = server_obj.instances[0].network_interfaces[0].subnet_id if vpc_mode?
|
165
|
+
server_data["source_dest_check"] = server_obj.instances[0].network_interfaces[0].source_dest_check if vpc_mode?
|
162
166
|
server_data["tags"] = tags
|
163
167
|
server_data["tenancy"] = server_obj.instances[0].placement.tenancy
|
164
168
|
server_data["volume_id"] = server_obj.instances[0].block_device_mappings[0]&.ebs&.volume_id
|
data/lib/knife-ec2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|