knife-ec2 1.0.12 → 1.0.14

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
  SHA256:
3
- metadata.gz: 0e09e4b811ac8fbfc3f15456c64b86e3e66507181825b1af08dbc814de3f1e75
4
- data.tar.gz: 97ce8aa909d10cf7ffe4e8096176447305bb2559a6a63e05e9801bcad6f17e2b
3
+ metadata.gz: 8743a633399f75cd0972d5961245645e3ae22ec4edafc86bfb5b70737d11dc66
4
+ data.tar.gz: cdbdf1c53d74247584b6c7a3efdbb0d0a842bf1162e15bfbca253ff4734ecae3
5
5
  SHA512:
6
- metadata.gz: 440dbf0295d37492c076fd3efacb0ec0132701d4860565a974757b5f23063579fccac6dc4086c1891863ea89152236cf43473489c98e5bfd3c9e1f4b3034802a
7
- data.tar.gz: b331a39d9db68adccabe21217620ebb4d51422b0800b5aac7a80c9f6a94072126f37aa3fc478ac10355a441c7bddd71483b2159729571be5b278d899d19049c2
6
+ metadata.gz: 041be22fe39119c853ae31fca29571d66aa24e484863dd15e3187fe2dd6a2f4c568db99cfa5153af1904d76ea89328555534c33fe403bc633788c4cb53b1b992
7
+ data.tar.gz: 5680eeb388afe0fd764a28eb29d51340bfe5b9b19740e74596bd6c59c8e9c64f6f8a216159f3a412227bf8aab9ed83babaa4111aee90adf1a2d0f3c80fe8b91d
@@ -158,6 +158,7 @@ class Chef
158
158
  server_data["security_group_ids"] = server_obj.instances[0].security_groups.map(&:group_id)
159
159
  server_data["state"] = server_obj.instances[0].state.name
160
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
161
162
  server_data["tags"] = tags
162
163
  server_data["tenancy"] = server_obj.instances[0].placement.tenancy
163
164
  server_data["volume_id"] = server_obj.instances[0].block_device_mappings[0]&.ebs&.volume_id
@@ -242,6 +242,12 @@ class Chef
242
242
  boolean: true,
243
243
  default: false
244
244
 
245
+ option :disable_source_dest_check,
246
+ long: "--disable-source-dest-check",
247
+ description: "Disables the source destination check if this option is passed. This value must be passed for a NAT instance to perform NAT.",
248
+ boolean: true,
249
+ default: false
250
+
245
251
  option :volume_tags,
246
252
  long: "--volume-tags Tag=Value[,Tag=Value...]",
247
253
  description: "Tag the Root volume",
@@ -326,7 +332,6 @@ class Chef
326
332
  exit
327
333
  end
328
334
  end
329
-
330
335
  msg_pair("Instance ID", server.id)
331
336
  msg_pair("Flavor", server.instance_type)
332
337
  msg_pair("Image", server.image_id)
@@ -347,6 +352,8 @@ class Chef
347
352
  # occasionally 'ready?' isn't, so retry a couple times if needed.
348
353
  tries = 6
349
354
  begin
355
+ disable_source_dest_check if vpc_mode? && config_value(:disable_source_dest_check)
356
+
350
357
  create_tags(hashed_tags) unless hashed_tags.empty?
351
358
  create_volume_tags(hashed_volume_tags) unless hashed_volume_tags.empty?
352
359
  associate_address(elastic_ip) if config[:associate_eip]
@@ -1235,6 +1242,18 @@ class Chef
1235
1242
  })
1236
1243
  end
1237
1244
 
1245
+ # disable_source_dest_check option is used to set value of source_dest_check attribute in ec2.
1246
+ # By default the source destination check is enabled in ec2.
1247
+ # This value must be disable for a NAT instance to perform NAT.
1248
+ def disable_source_dest_check
1249
+ ec2_connection.modify_instance_attribute({
1250
+ source_dest_check: {
1251
+ value: false,
1252
+ },
1253
+ instance_id: server.id,
1254
+ })
1255
+ end
1256
+
1238
1257
  def tcp_test_winrm(ip_addr, port)
1239
1258
  tcp_socket = TCPSocket.new(ip_addr, port)
1240
1259
  yield
@@ -133,7 +133,7 @@ class Chef
133
133
  servers_list << v["public_ip_address"]
134
134
  servers_list << v["private_ip_address"]
135
135
  servers_list << v["instance_type"]
136
- servers_list << v["az"] if config[:az]
136
+ servers_list << ui.color(v["az"], azcolor(v["az"])) if config[:az]
137
137
  servers_list << v["image_id"]
138
138
  servers_list << v["key_name"]
139
139
  servers_list << v["security_groups"].join(",")
@@ -143,7 +143,7 @@ class Chef
143
143
  end
144
144
  end
145
145
  servers_list << v["iam_instance_profile"].to_s if config[:iamprofile] # may be nil
146
- servers_list << v["state"]
146
+ servers_list << ui.color(v["state"], state_color(v["state"]))
147
147
  end
148
148
  puts ui.list(servers_list, :uneven_columns_across, output_column_count)
149
149
  else
@@ -170,12 +170,12 @@ class Chef
170
170
  end
171
171
 
172
172
  if config[:az]
173
- server_data["az"] = ui.color(i.instances[0].placement.availability_zone, azcolor(i.instances[0].placement.availability_zone))
173
+ server_data["az"] = i.instances[0].placement.availability_zone
174
174
  end
175
175
 
176
176
  server_data["iam_instance_profile"] = ( i.instances[0].iam_instance_profile.nil? ? nil : i.instances[0].iam_instance_profile.arn[%r{instance-profile/(.*)}] )
177
177
 
178
- server_data["state"] = ui.color(i.instances[0].state.name, state_color(i.instances[0].state.name))
178
+ server_data["state"] = i.instances[0].state.name
179
179
 
180
180
  if config[:tags]
181
181
  server_data["tags"] = tags
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ec2
3
- VERSION = "1.0.12".freeze
3
+ VERSION = "1.0.14".freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
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.12
4
+ version: 1.0.14
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: 2019-08-09 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef