knife-ec2 2.1.6 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62b16f2073f8b2ee3ef35518c860b18f0e16a6734aa9f5578ed768e5ef4072af
4
- data.tar.gz: 8334d4b0fb87418ddb12a244114067b1ff41c39a2bcf0e95f9c03d3812d6c672
3
+ metadata.gz: 1c9e95c46220d9a4108d3f92dced810864d8df0439108d1478d00f0239c6a1c0
4
+ data.tar.gz: ae0bce69fb7b2e7f0405db5a484b99adfb2dc8872c5b60fc860c61e988e05f62
5
5
  SHA512:
6
- metadata.gz: 73b53887684bd8a895d761a1d89d2777daf7778b731524a13b055757bfbd4d83630052805cc584a40057736eb461f65d40fee6dc45ed434720ce62aa35957f58
7
- data.tar.gz: f4de7a408a71457a8fa67ee99e071447331d73e842aed67bf1ccbe07e64bc8164e868b9fda32ae867b7bed885057f68c525b140af51c49c1f553741a1f5dd1c4
6
+ metadata.gz: 1fa2fa5e742a2e30267d02b1c0ab5663559eb15290c936f3fac5501a13eac5f045256b4ec105f828fefd90b8eacfce4173a633a726d71fbb13f3b8ba1395c4b5
7
+ data.tar.gz: 8602b3465992ec4c0674f879ed8c22a7dc413588d7272c453e80a3a678cf24a8baf896ce0df12d3ec06f7010ea70f75a83f773a36de70d3648eb76022ce74e0e
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Piyush Awasthi (<piyush.awasthi@msystechnologies.com>)
3
- # Copyright:: Copyright (c) Chef Software Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -93,18 +93,23 @@ class Chef
93
93
 
94
94
  def ami_hashes
95
95
  all_data = {}
96
- ec2_connection.describe_images(image_params).images.each do |v|
96
+ response = ec2_connection.describe_images(image_params)
97
+ response.images.each do |v|
97
98
  v_data = {}
98
99
  if config[:search]
99
- next unless v.description.downcase.include?(config[:search].downcase)
100
+ next unless v.description.to_s.downcase.include?(config[:search].downcase)
100
101
  end
101
102
 
102
103
  %w{image_id platform description architecture}.each do |id|
103
- v_data[id] = v.send(id)
104
+ v_data[id] = v.respond_to?(id) ? v.send(id) : v[id]
104
105
  end
105
106
 
106
- v_data["name"] = v.name.split(/\W+/).first
107
- v_data["size"] = v.block_device_mappings[0].ebs.volume_size.to_s
107
+ name = v.respond_to?(:name) ? v.name : v[:name]
108
+ v_data["name"] = name ? name.split(/\W+/).first : nil
109
+
110
+ mappings = v.respond_to?(:block_device_mappings) ? v.block_device_mappings : v[:block_device_mappings]
111
+ v_data["size"] = mappings && mappings[0] && mappings[0][:ebs] ? mappings[0][:ebs][:volume_size].to_s : nil
112
+
108
113
  all_data[v_data["image_id"]] = v_data
109
114
  end
110
115
  all_data
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Tim Smith (<tsmith@chef.io>)
3
- # Copyright:: Copyright (c) 2018-2019 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Seth Chisamore (<schisamo@chef.io>)
3
- # Copyright:: Copyright (c) 2012-2019 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Tim Smith (<tsmith@chef.io>)
3
- # Copyright:: Copyright (c) 2018-2019 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) Chef Software Inc.
4
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -334,10 +334,16 @@ class Chef
334
334
  msg_pair("IAM Profile", config[:iam_instance_profile])
335
335
 
336
336
  msg_pair("AWS Tags", printed_aws_tags)
337
+
337
338
  msg_pair("Volume Tags", printed_volume_tags)
338
339
  msg_pair("SSH Key", server.key_name)
339
340
  msg_pair("T2/T3 Unlimited", printed_t2_t3_unlimited)
340
341
 
342
+ # Update Name tag after instance creation if chef_node_name contains %s
343
+ if config[:chef_node_name] && config[:chef_node_name].include?("%s")
344
+ config[:chef_node_name] = evaluate_node_name(config[:chef_node_name])
345
+ end
346
+
341
347
  puts("\n")
342
348
 
343
349
  # occasionally 'ready?' isn't, so retry a couple times if needed.
@@ -981,6 +987,16 @@ class Chef
981
987
  cpu_credits: config[:cpu_credits],
982
988
  }
983
989
  end
990
+ # Add tag_specifications for instance tags at creation time
991
+ tags = hashed_tags.map { |k, v| { key: k, value: v } }
992
+ unless tags.empty?
993
+ attributes[:tag_specifications] = [
994
+ {
995
+ resource_type: "instance",
996
+ tags: tags,
997
+ },
998
+ ]
999
+ end
984
1000
  attributes
985
1001
  end
986
1002
 
@@ -1448,9 +1464,9 @@ class Chef
1448
1464
  # Always set the Name tag
1449
1465
  unless ht.key?("Name")
1450
1466
  if config[:chef_node_name]
1451
- ht["Name"] = evaluate_node_name(config[:chef_node_name])
1467
+ ht["Name"] = config[:chef_node_name]
1452
1468
  else
1453
- ht["Name"] = server.id
1469
+ ht["Name"] = server&.id
1454
1470
  end
1455
1471
  end
1456
1472
 
@@ -1475,3 +1491,4 @@ class Chef
1475
1491
  end
1476
1492
  end
1477
1493
  end
1494
+
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) 2009-2019 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) Chef Software Inc.
4
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Tim Smith (<tsmith@chef.io>)
3
- # Copyright:: Copyright (c) 2018-2019 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Tim Smith (<tsmith@chef.io>)
3
- # Copyright:: Copyright (c) 2018-2019 Chef Software, Inc.
3
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,7 +1,7 @@
1
1
 
2
2
  #
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) Chef Software Inc.
4
+ # Copyright:: Copyright (c) 2011-2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -184,8 +184,17 @@ class Chef
184
184
  # Name tag value return.
185
185
  # @return [String]
186
186
  def find_name_tag(tags)
187
- name_tag = tags.find { |tag| tag[:key] == "Name" }
188
- name_tag ? name_tag[:value] : nil
187
+ name_tag = tags.find do |tag|
188
+ key_value = tag.respond_to?(:key) ? tag.key : (tag[:key] || tag["key"])
189
+ key_value == "Name"
190
+ end
191
+ if name_tag
192
+ if name_tag.respond_to?(:value)
193
+ name_tag.value
194
+ else
195
+ name_tag[:value] || name_tag["value"]
196
+ end
197
+ end
189
198
  end
190
199
 
191
200
  # Platform value return for Windows AMIs; otherwise, it is blank.
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ec2
3
- VERSION = "2.1.6".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.2.0
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: 2024-04-02 00:00:00.000000000 Z
11
+ date: 2026-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knife
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '18.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '18.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.95'
55
+ - !ruby/object:Gem::Dependency
56
+ name: abbrev
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: syslog
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.3'
55
83
  description: Amazon EC2 Support for Chef's Knife Command
56
84
  email:
57
85
  - info@chef.io
@@ -91,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
119
  - !ruby/object:Gem::Version
92
120
  version: '0'
93
121
  requirements: []
94
- rubygems_version: 3.1.4
122
+ rubygems_version: 3.3.27
95
123
  signing_key:
96
124
  specification_version: 4
97
125
  summary: Amazon EC2 Support for Chef's Knife Command