knife 17.10.163 → 18.0.185
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -3
- data/knife.gemspec +6 -11
- data/lib/chef/knife/bootstrap.rb +6 -23
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/supermarket_install.rb +1 -1
- data/lib/chef/knife/user_edit.rb +1 -1
- data/lib/chef/knife/version.rb +1 -1
- data/spec/support/platform_helpers.rb +4 -0
- data/spec/unit/knife/bootstrap_spec.rb +1 -40
- metadata +19 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e742e28f2ceaa387aad09ef23468206ebaadc2b50579477bda84bd1c9f57d6b1
|
4
|
+
data.tar.gz: c604ef8fb1c951e1d21862803459b35b3ca86015531f8797985887f7bd879549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eabe1e671b1505b7f8efa5eb0fe9e3773dacdc43fe21b23ad38a6d3a080bb9daa71c7a48902f1047c7102a1a82afb5aedc16a90f3c5f97eb0d8d9472cbb94e09
|
7
|
+
data.tar.gz: d412cabefacc6c5e43d5bf3970d1ccc16bb002a68390117460f25cb98c0e0a61e147c1277139a8ad4777f5a0a4314476e39fb65207b4e8343d9c3d8aee099328
|
data/Gemfile
CHANGED
@@ -2,10 +2,12 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gem "knife", path: "."
|
4
4
|
|
5
|
+
# proxifier gem is busted on ruby 3.1 and seems abandoned so use git fork of gem
|
6
|
+
gem "proxifier", git: "https://github.com/chef/ruby-proxifier", branch: "lcg/ruby-3"
|
7
|
+
|
5
8
|
group(:development, :test) do
|
6
9
|
gem "cheffish", ">= 14" # testing only , but why didn't this need to explicit in chef?
|
7
|
-
gem "webmock"
|
8
|
-
gem "crack", "< 0.4.6" # due to https://github.com/jnunemaker/crack/pull/75
|
10
|
+
gem "webmock" # testing only
|
9
11
|
gem "rake"
|
10
12
|
gem "rspec"
|
11
13
|
gem "chef-bin", path: "../chef-bin"
|
@@ -21,7 +23,7 @@ group(:chefstyle) do
|
|
21
23
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "main"
|
22
24
|
end
|
23
25
|
|
24
|
-
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "
|
26
|
+
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "main"
|
25
27
|
gem "chef", path: ".."
|
26
28
|
gem "chef-utils", path: File.expand_path("../chef-utils", __dir__) if File.exist?(File.expand_path("../chef-utils", __dir__))
|
27
29
|
gem "chef-config", path: File.expand_path("../chef-config", __dir__) if File.exist?(File.expand_path("../chef-config", __dir__))
|
data/knife.gemspec
CHANGED
@@ -13,18 +13,18 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.email = "adam@chef.io" # These seem a bit out of date, and this address probably doesn't go anywhere anymore?
|
14
14
|
s.homepage = "https://www.chef.io"
|
15
15
|
|
16
|
-
s.required_ruby_version = ">= 3.
|
16
|
+
s.required_ruby_version = ">= 3.1.0"
|
17
17
|
|
18
|
-
s.add_dependency "chef-config", ">= #{Chef::Knife::VERSION.split(".").first}"
|
19
|
-
s.add_dependency "chef-utils", ">= #{Chef::Knife::VERSION.split(".").first}"
|
20
|
-
s.add_dependency "chef", ">= #{Chef::Knife::VERSION.split(".").first}"
|
18
|
+
s.add_dependency "chef-config", ">= #{Chef::Knife::VERSION.split(".").first}"
|
19
|
+
s.add_dependency "chef-utils", ">= #{Chef::Knife::VERSION.split(".").first}"
|
20
|
+
s.add_dependency "chef", ">= #{Chef::Knife::VERSION.split(".").first}"
|
21
21
|
s.add_dependency "train-core", "~> 3.10" # 3.2.28 fixes sudo prompts. See https://github.com/chef/chef/pull/9635
|
22
22
|
s.add_dependency "train-winrm", ">= 0.2.5"
|
23
23
|
s.add_dependency "license-acceptance", ">= 1.0.5", "< 3"
|
24
24
|
s.add_dependency "mixlib-cli", ">= 2.1.1", "< 3.0"
|
25
25
|
s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
|
26
|
-
s.add_dependency "ohai", "~>
|
27
|
-
s.add_dependency "ffi", "
|
26
|
+
s.add_dependency "ohai", "~> 18.0"
|
27
|
+
s.add_dependency "ffi", ">= 1.15" # 1.14 versions are broken on i386 windows
|
28
28
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
29
29
|
s.add_dependency "net-ssh", ">= 5.1", "< 8"
|
30
30
|
s.add_dependency "net-ssh-multi", "~> 1.2", ">= 1.2.1"
|
@@ -39,11 +39,6 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.add_dependency "pastel" # knife ui.color
|
40
40
|
s.add_dependency "erubis", "~> 2.7"
|
41
41
|
s.add_dependency "chef-vault" # knife vault
|
42
|
-
if RUBY_VERSION.match?("3.0.0")
|
43
|
-
# Ruby 3.0.0 on Fedora specifically makes trouble
|
44
|
-
s.add_dependency "uri", "= 0.10.1"
|
45
|
-
end
|
46
|
-
s.add_dependency "proxifier2", "~> 1.1"
|
47
42
|
|
48
43
|
s.add_development_dependency "chefstyle"
|
49
44
|
|
data/lib/chef/knife/bootstrap.rb
CHANGED
@@ -32,7 +32,7 @@ class Chef
|
|
32
32
|
include DataBagSecretOptions
|
33
33
|
include LicenseAcceptance::CLIFlags::MixlibCLI
|
34
34
|
|
35
|
-
|
35
|
+
SUPPORTED_CONNECTION_PROTOCOLS ||= %w{ssh winrm}.freeze
|
36
36
|
WINRM_AUTH_PROTOCOL_LIST ||= %w{plaintext kerberos ssl negotiate}.freeze
|
37
37
|
|
38
38
|
# Common connectivity options
|
@@ -54,7 +54,8 @@ class Chef
|
|
54
54
|
option :connection_protocol,
|
55
55
|
short: "-o PROTOCOL",
|
56
56
|
long: "--connection-protocol PROTOCOL",
|
57
|
-
description: "The protocol to use to connect to the target node.
|
57
|
+
description: "The protocol to use to connect to the target node.",
|
58
|
+
in: SUPPORTED_CONNECTION_PROTOCOLS
|
58
59
|
|
59
60
|
option :max_wait,
|
60
61
|
short: "-W SECONDS",
|
@@ -809,11 +810,11 @@ class Chef
|
|
809
810
|
exit 1
|
810
811
|
end
|
811
812
|
|
812
|
-
unless
|
813
|
+
unless SUPPORTED_CONNECTION_PROTOCOLS.include?(connection_protocol)
|
813
814
|
ui.error <<~EOM
|
814
815
|
Unsupported protocol '#{connection_protocol}'.
|
815
816
|
|
816
|
-
Supported protocols are: #{
|
817
|
+
Supported protocols are: #{SUPPORTED_CONNECTION_PROTOCOLS.join(" ")}
|
817
818
|
EOM
|
818
819
|
exit 1
|
819
820
|
end
|
@@ -972,7 +973,7 @@ class Chef
|
|
972
973
|
# for this. We will also set keys_only to false only if there are keys
|
973
974
|
# and no password.
|
974
975
|
# If both are present, train(via net/ssh) will prefer keys, falling back to password.
|
975
|
-
# Reference: https://github.com/chef/chef/blob/
|
976
|
+
# Reference: https://github.com/chef/chef/blob/main/lib/chef/knife/ssh.rb#L272
|
976
977
|
opts[:keys_only] = config.key?(:connection_password) == false
|
977
978
|
else
|
978
979
|
opts[:key_files] = []
|
@@ -1187,24 +1188,6 @@ class Chef
|
|
1187
1188
|
|
1188
1189
|
connection&.connection&.transport_options&.merge! opts
|
1189
1190
|
end
|
1190
|
-
|
1191
|
-
# List Train transports available (but not loaded) on system.
|
1192
|
-
#
|
1193
|
-
# Will filter out train-core, API transports, and other incompatible ones.
|
1194
|
-
#
|
1195
|
-
# @return [Array] transport_names which can be used for command execution
|
1196
|
-
def transports_available
|
1197
|
-
train_gems = Gem::Specification.select { |spec| spec.name.start_with? "train-" }
|
1198
|
-
train_gems.delete_if { |spec| TRANSPORTS_BLACKLIST.include? spec.name }
|
1199
|
-
train_gems.map { |spec| spec.name.delete_prefix "train-" }
|
1200
|
-
end
|
1201
|
-
|
1202
|
-
# Return all supported connection types, classical and Train-based
|
1203
|
-
#
|
1204
|
-
# @return [Array] connection types supported
|
1205
|
-
def supported_connection_protocols
|
1206
|
-
%w{ssh winrm} | transports_available
|
1207
|
-
end
|
1208
1191
|
end
|
1209
1192
|
end
|
1210
1193
|
end
|
data/lib/chef/knife/core/ui.rb
CHANGED
@@ -233,7 +233,7 @@ class Chef
|
|
233
233
|
tf.sync = true
|
234
234
|
tf.puts output
|
235
235
|
tf.close
|
236
|
-
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup
|
236
|
+
raise "Please set EDITOR environment variable. See https://docs.chef.io/workstation/knife_setup/#setting-your-text-editor for details." unless system("#{config[:editor]} #{tf.path}")
|
237
237
|
|
238
238
|
output = IO.read(tf.path)
|
239
239
|
end
|
data/lib/chef/knife/edit.rb
CHANGED
@@ -74,7 +74,7 @@ class Chef
|
|
74
74
|
|
75
75
|
# Let the user edit the temporary file
|
76
76
|
unless system("#{config[:editor]} #{file.path}")
|
77
|
-
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup
|
77
|
+
raise "Please set EDITOR environment variable. See https://docs.chef.io/workstation/knife_setup/#setting-your-text-editor for details."
|
78
78
|
end
|
79
79
|
|
80
80
|
result_text = IO.read(file.path)
|
@@ -156,7 +156,7 @@ class Chef
|
|
156
156
|
|
157
157
|
def convert_path(upstream_file)
|
158
158
|
# converts a Windows path (C:\foo) to a mingw path (/c/foo)
|
159
|
-
if ENV["MSYSTEM"] == "MINGW32"
|
159
|
+
if ENV["MSYSTEM"] == ( "MINGW32" || "UCRT64" )
|
160
160
|
upstream_file.sub(/^([[:alpha:]]):/, '/\1')
|
161
161
|
else
|
162
162
|
Shellwords.escape upstream_file
|
data/lib/chef/knife/user_edit.rb
CHANGED
@@ -81,7 +81,7 @@ class Chef
|
|
81
81
|
f.sync = true
|
82
82
|
f.puts output
|
83
83
|
f.close
|
84
|
-
raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_setup
|
84
|
+
raise "Please set EDITOR environment variable. See https://docs.chef.io/workstation/knife_setup/#setting-your-text-editor for details." unless system("#{config[:editor]} #{f.path}")
|
85
85
|
|
86
86
|
edited_user = JSON.parse(IO.read(f.path))
|
87
87
|
end
|
data/lib/chef/knife/version.rb
CHANGED
@@ -127,6 +127,10 @@ def freebsd?
|
|
127
127
|
RUBY_PLATFORM.include?("freebsd")
|
128
128
|
end
|
129
129
|
|
130
|
+
def freebsd_gte_12_3?
|
131
|
+
RUBY_PLATFORM.include?("freebsd") && !!(ohai[:platform_version].to_f >= 12.3)
|
132
|
+
end
|
133
|
+
|
130
134
|
def intel_64bit?
|
131
135
|
!!(ohai[:kernel][:machine] == "x86_64")
|
132
136
|
end
|
@@ -682,7 +682,7 @@ describe Chef::Knife::Bootstrap do
|
|
682
682
|
|
683
683
|
context "and the protocol is supported" do
|
684
684
|
|
685
|
-
|
685
|
+
Chef::Knife::Bootstrap::SUPPORTED_CONNECTION_PROTOCOLS.each do |proto|
|
686
686
|
let(:connection_protocol) { proto }
|
687
687
|
it "returns true for #{proto}" do
|
688
688
|
expect(knife.validate_protocol!).to eq true
|
@@ -697,45 +697,6 @@ describe Chef::Knife::Bootstrap do
|
|
697
697
|
expect { knife.validate_protocol! }.to raise_error SystemExit
|
698
698
|
end
|
699
699
|
end
|
700
|
-
|
701
|
-
context "when additional Train transports are present" do
|
702
|
-
before do
|
703
|
-
Gem::Specification.new do |spec|
|
704
|
-
spec.name = "train-rfc2549"
|
705
|
-
spec.version = "0.0.1"
|
706
|
-
spec.summary = "Train transport to use IPoAC"
|
707
|
-
end.activate
|
708
|
-
|
709
|
-
Gem.refresh
|
710
|
-
end
|
711
|
-
|
712
|
-
context "and their usage is supported" do
|
713
|
-
let(:connection_protocol) { "rfc2549" }
|
714
|
-
it "accepts the transport as protocol" do
|
715
|
-
# While the Gem mocking above will work in native RSpec, it will
|
716
|
-
# fail when executed as part of the test suite via Bundler.
|
717
|
-
#
|
718
|
-
# Reason for this is, that Bundler effectively replaces the whole
|
719
|
-
# gem loading architecture. Mocking the Gem inside of Bundler will
|
720
|
-
# have to reach deep into its internal implementation and make
|
721
|
-
# the test tighly-coupled and brittle.
|
722
|
-
#
|
723
|
-
# During the discussion on PR 13534, it was decided to skip the
|
724
|
-
# test as a result and add this explanation for future reference.
|
725
|
-
|
726
|
-
# expect(knife.validate_protocol!).to eq true
|
727
|
-
skip
|
728
|
-
end
|
729
|
-
end
|
730
|
-
|
731
|
-
context "and invalid proctocols are still refused" do
|
732
|
-
let(:connection_protocol) { "rfc6216" }
|
733
|
-
it "accepts the transport as protocol" do
|
734
|
-
expect(knife.ui).to receive(:error).with(/Unsupported protocol '#{connection_protocol}'/)
|
735
|
-
expect { knife.validate_protocol! }.to raise_error SystemExit
|
736
|
-
end
|
737
|
-
end
|
738
|
-
end
|
739
700
|
end
|
740
701
|
|
741
702
|
describe "#validate_policy_options!" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 18.0.185
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,60 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '18.0'
|
19
|
+
version: '18'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '18.0'
|
26
|
+
version: '18'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: chef-utils
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
- - "<"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '18.0'
|
33
|
+
version: '18'
|
43
34
|
type: :runtime
|
44
35
|
prerelease: false
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
46
37
|
requirements:
|
47
38
|
- - ">="
|
48
39
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
-
- - "<"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '18.0'
|
40
|
+
version: '18'
|
53
41
|
- !ruby/object:Gem::Dependency
|
54
42
|
name: chef
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
56
44
|
requirements:
|
57
45
|
- - ">="
|
58
46
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
60
|
-
- - "<"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '18.0'
|
47
|
+
version: '18'
|
63
48
|
type: :runtime
|
64
49
|
prerelease: false
|
65
50
|
version_requirements: !ruby/object:Gem::Requirement
|
66
51
|
requirements:
|
67
52
|
- - ">="
|
68
53
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
70
|
-
- - "<"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '18.0'
|
54
|
+
version: '18'
|
73
55
|
- !ruby/object:Gem::Dependency
|
74
56
|
name: train-core
|
75
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,28 +146,28 @@ dependencies:
|
|
164
146
|
requirements:
|
165
147
|
- - "~>"
|
166
148
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
149
|
+
version: '18.0'
|
168
150
|
type: :runtime
|
169
151
|
prerelease: false
|
170
152
|
version_requirements: !ruby/object:Gem::Requirement
|
171
153
|
requirements:
|
172
154
|
- - "~>"
|
173
155
|
- !ruby/object:Gem::Version
|
174
|
-
version: '
|
156
|
+
version: '18.0'
|
175
157
|
- !ruby/object:Gem::Dependency
|
176
158
|
name: ffi
|
177
159
|
requirement: !ruby/object:Gem::Requirement
|
178
160
|
requirements:
|
179
|
-
- - "
|
161
|
+
- - ">="
|
180
162
|
- !ruby/object:Gem::Version
|
181
|
-
version: 1.15
|
163
|
+
version: '1.15'
|
182
164
|
type: :runtime
|
183
165
|
prerelease: false
|
184
166
|
version_requirements: !ruby/object:Gem::Requirement
|
185
167
|
requirements:
|
186
|
-
- - "
|
168
|
+
- - ">="
|
187
169
|
- !ruby/object:Gem::Version
|
188
|
-
version: 1.15
|
170
|
+
version: '1.15'
|
189
171
|
- !ruby/object:Gem::Dependency
|
190
172
|
name: ffi-yajl
|
191
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,20 +340,6 @@ dependencies:
|
|
358
340
|
- - ">="
|
359
341
|
- !ruby/object:Gem::Version
|
360
342
|
version: '0'
|
361
|
-
- !ruby/object:Gem::Dependency
|
362
|
-
name: proxifier2
|
363
|
-
requirement: !ruby/object:Gem::Requirement
|
364
|
-
requirements:
|
365
|
-
- - "~>"
|
366
|
-
- !ruby/object:Gem::Version
|
367
|
-
version: '1.1'
|
368
|
-
type: :runtime
|
369
|
-
prerelease: false
|
370
|
-
version_requirements: !ruby/object:Gem::Requirement
|
371
|
-
requirements:
|
372
|
-
- - "~>"
|
373
|
-
- !ruby/object:Gem::Version
|
374
|
-
version: '1.1'
|
375
343
|
- !ruby/object:Gem::Dependency
|
376
344
|
name: chefstyle
|
377
345
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1147,7 +1115,7 @@ metadata:
|
|
1147
1115
|
homepage_uri: https://www.chef.io
|
1148
1116
|
mailing_list_uri: https://discourse.chef.io/
|
1149
1117
|
source_code_uri: https://github.com/chef/chef/
|
1150
|
-
post_install_message:
|
1118
|
+
post_install_message:
|
1151
1119
|
rdoc_options: []
|
1152
1120
|
require_paths:
|
1153
1121
|
- lib
|
@@ -1155,18 +1123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1155
1123
|
requirements:
|
1156
1124
|
- - ">="
|
1157
1125
|
- !ruby/object:Gem::Version
|
1158
|
-
version: 3.
|
1159
|
-
- - "<"
|
1160
|
-
- !ruby/object:Gem::Version
|
1161
|
-
version: '3.1'
|
1126
|
+
version: 3.1.0
|
1162
1127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1163
1128
|
requirements:
|
1164
1129
|
- - ">="
|
1165
1130
|
- !ruby/object:Gem::Version
|
1166
1131
|
version: '0'
|
1167
1132
|
requirements: []
|
1168
|
-
rubygems_version: 3.
|
1169
|
-
signing_key:
|
1133
|
+
rubygems_version: 3.3.21
|
1134
|
+
signing_key:
|
1170
1135
|
specification_version: 4
|
1171
1136
|
summary: The knife CLI for Chef Infra.
|
1172
1137
|
test_files: []
|