knife-ec2 2.1.4 → 2.1.6
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 +33 -33
- data/lib/chef/knife/helpers/ec2_base.rb +5 -7
- data/lib/knife-ec2/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62b16f2073f8b2ee3ef35518c860b18f0e16a6734aa9f5578ed768e5ef4072af
|
4
|
+
data.tar.gz: 8334d4b0fb87418ddb12a244114067b1ff41c39a2bcf0e95f9c03d3812d6c672
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b53887684bd8a895d761a1d89d2777daf7778b731524a13b055757bfbd4d83630052805cc584a40057736eb461f65d40fee6dc45ed434720ce62aa35957f58
|
7
|
+
data.tar.gz: f4de7a408a71457a8fa67ee99e071447331d73e842aed67bf1ccbe07e64bc8164e868b9fda32ae867b7bed885057f68c525b140af51c49c1f553741a1f5dd1c4
|
@@ -25,6 +25,10 @@ class Chef
|
|
25
25
|
class Knife
|
26
26
|
class Ec2ServerCreate < Chef::Knife::Bootstrap
|
27
27
|
|
28
|
+
GP_VOLUME_TYPES = %w{gp2 gp3}.freeze
|
29
|
+
IOPS_VOLUME_TYPES = %w{io1 io2}.freeze
|
30
|
+
EBS_VOLUME_TYPES = (%w{standard st1 sc1} + GP_VOLUME_TYPES + IOPS_VOLUME_TYPES).freeze
|
31
|
+
|
28
32
|
include Knife::Ec2Base
|
29
33
|
|
30
34
|
deps do
|
@@ -161,12 +165,12 @@ class Chef
|
|
161
165
|
|
162
166
|
option :ebs_volume_type,
|
163
167
|
long: "--ebs-volume-type TYPE",
|
164
|
-
description: "Possible values are
|
165
|
-
default: "
|
168
|
+
description: "Possible values are #{EBS_VOLUME_TYPES.join(" | ")}. Default is gp3",
|
169
|
+
default: "gp3"
|
166
170
|
|
167
171
|
option :ebs_provisioned_iops,
|
168
172
|
long: "--provisioned-iops IOPS",
|
169
|
-
description: "IOPS rate, only used when ebs volume type is '
|
173
|
+
description: "IOPS rate, only used when ebs volume type is '#{IOPS_VOLUME_TYPES.join(" or ")}'",
|
170
174
|
default: nil
|
171
175
|
|
172
176
|
option :validation_key_url,
|
@@ -495,13 +499,11 @@ class Chef
|
|
495
499
|
end
|
496
500
|
|
497
501
|
def validation_key_path
|
498
|
-
@validation_key_path ||=
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
end
|
504
|
-
end
|
502
|
+
@validation_key_path ||= if URI(config[:validation_key_url]).scheme == "file"
|
503
|
+
URI(config[:validation_key_url]).path
|
504
|
+
else
|
505
|
+
validation_key_tmpfile.path
|
506
|
+
end
|
505
507
|
end
|
506
508
|
|
507
509
|
# @return [Tempfile]
|
@@ -521,9 +523,7 @@ class Chef
|
|
521
523
|
end
|
522
524
|
|
523
525
|
def s3_validation_key
|
524
|
-
@s3_validation_key ||=
|
525
|
-
Chef::Knife::S3Source.fetch(config[:validation_key_url], config)
|
526
|
-
end
|
526
|
+
@s3_validation_key ||= Chef::Knife::S3Source.fetch(config[:validation_key_url], config)
|
527
527
|
end
|
528
528
|
|
529
529
|
def s3_secret
|
@@ -616,18 +616,18 @@ class Chef
|
|
616
616
|
end
|
617
617
|
end
|
618
618
|
|
619
|
-
if config[:ebs_provisioned_iops] && (config[:ebs_volume_type]
|
620
|
-
ui.error("--provisioned-iops option is only supported for volume type of '
|
619
|
+
if config[:ebs_provisioned_iops] && !IOPS_VOLUME_TYPES.include?(config[:ebs_volume_type])
|
620
|
+
ui.error("--provisioned-iops option is only supported for volume type of '#{IOPS_VOLUME_TYPES.join(" or ")}'")
|
621
621
|
exit 1
|
622
622
|
end
|
623
623
|
|
624
|
-
if (config[:ebs_volume_type]
|
625
|
-
ui.error("--provisioned-iops option is required when using volume type of '
|
624
|
+
if IOPS_VOLUME_TYPES.include?(config[:ebs_volume_type]) && config[:ebs_provisioned_iops].nil?
|
625
|
+
ui.error("--provisioned-iops option is required when using volume type of '#{IOPS_VOLUME_TYPES.join(" or ")}'")
|
626
626
|
exit 1
|
627
627
|
end
|
628
628
|
|
629
|
-
if config[:ebs_volume_type] && !
|
630
|
-
ui.error("--ebs-volume-type must be '
|
629
|
+
if config[:ebs_volume_type] && ! EBS_VOLUME_TYPES.include?(config[:ebs_volume_type])
|
630
|
+
ui.error("--ebs-volume-type must be '#{EBS_VOLUME_TYPES.join("' or '")}'")
|
631
631
|
msg opt_parser
|
632
632
|
exit 1
|
633
633
|
end
|
@@ -682,10 +682,12 @@ class Chef
|
|
682
682
|
# validation for ebs_size and ebs_volume_type and ebs_encrypted
|
683
683
|
if !config[:ebs_size]
|
684
684
|
errors << "--ebs-encrypted option requires valid --ebs-size to be specified."
|
685
|
-
elsif (config[:ebs_volume_type]
|
686
|
-
errors << "--ebs-size should be in between 1-16384 for '
|
685
|
+
elsif (GP_VOLUME_TYPES.include?(config[:ebs_volume_type])) && ! config[:ebs_size].to_i.between?(1, 16384)
|
686
|
+
errors << "--ebs-size should be in between 1-16384 for '#{GP_VOLUME_TYPES.join("' or '")}' ebs volume type."
|
687
687
|
elsif (config[:ebs_volume_type] == "io1") && ! config[:ebs_size].to_i.between?(4, 16384)
|
688
688
|
errors << "--ebs-size should be in between 4-16384 for 'io1' ebs volume type."
|
689
|
+
elsif (config[:ebs_volume_type] == "io2") && ! config[:ebs_size].to_i.between?(4, 65536)
|
690
|
+
errors << "--ebs-size should be in between 4-65536 for 'io2' ebs volume type."
|
689
691
|
elsif (config[:ebs_volume_type] == "standard") && ! config[:ebs_size].to_i.between?(1, 1024)
|
690
692
|
errors << "--ebs-size should be in between 1-1024 for 'standard' ebs volume type."
|
691
693
|
end
|
@@ -757,8 +759,8 @@ class Chef
|
|
757
759
|
user = connection_user.split("\\")
|
758
760
|
if (user[0] == ".") || (user[0] == "") || (user.length == 1)
|
759
761
|
user_related_commands = <<~EOH
|
760
|
-
net user /add #{connection_user.delete(
|
761
|
-
net localgroup Administrators /add #{connection_user.delete(
|
762
|
+
net user /add #{connection_user.delete(".\\")} #{windows_password} #{@allow_long_password};
|
763
|
+
net localgroup Administrators /add #{connection_user.delete(".\\")};
|
762
764
|
EOH
|
763
765
|
end
|
764
766
|
<<~EOH
|
@@ -953,7 +955,7 @@ class Chef
|
|
953
955
|
ebs: {
|
954
956
|
delete_on_termination: delete_term,
|
955
957
|
volume_size: ebs_size,
|
956
|
-
volume_type: config[:ebs_volume_type], # accepts standard, io1, gp2, sc1, st1
|
958
|
+
volume_type: config[:ebs_volume_type], # accepts standard, io1, io2, gp2, gp3, sc1, st1
|
957
959
|
},
|
958
960
|
}]
|
959
961
|
attributes[:block_device_mappings][0][:ebs][:iops] = iops_rate unless iops_rate.nil? || iops_rate.empty?
|
@@ -1139,15 +1141,13 @@ class Chef
|
|
1139
1141
|
# Otherwise assign public DNS or public IP.
|
1140
1142
|
# @return [String]
|
1141
1143
|
def connect_attribute
|
1142
|
-
@connect_attribute ||=
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
end
|
1150
|
-
end
|
1144
|
+
@connect_attribute ||= if !!config[:server_connect_attribute]
|
1145
|
+
config[:server_connect_attribute]
|
1146
|
+
elsif vpc_mode? && !(subnet_public_ip_on_launch? || config[:associate_public_ip] || config[:associate_eip])
|
1147
|
+
"private_ip_address"
|
1148
|
+
else
|
1149
|
+
server.public_dns_name ? "public_dns_name" : "public_ip_address"
|
1150
|
+
end
|
1151
1151
|
end
|
1152
1152
|
|
1153
1153
|
def create_tags(hashed_tags)
|
@@ -234,13 +234,11 @@ class Chef
|
|
234
234
|
# if default location exists on disk fallback to that
|
235
235
|
# @return [String, nil] location to aws credentials file or nil if none exists
|
236
236
|
def aws_cred_file_location
|
237
|
-
@cred_file ||=
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
end
|
243
|
-
end
|
237
|
+
@cred_file ||= if !config[:aws_credential_file].nil?
|
238
|
+
config[:aws_credential_file]
|
239
|
+
else
|
240
|
+
Chef::Util::PathHelper.home(".aws", "credentials") if ::File.exist?(Chef::Util::PathHelper.home(".aws", "credentials"))
|
241
|
+
end
|
244
242
|
end
|
245
243
|
|
246
244
|
# @return [String]
|
data/lib/knife-ec2/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
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:
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: knife
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
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
|
-
version: '
|
26
|
+
version: '18.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sdk-s3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements:
|
85
85
|
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '3.1'
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - ">="
|