knife 17.10.0 → 17.10.95

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: 555723f352d005f6f3433b771c6804d8cf70b83b983baa9d626d9c2438609443
4
- data.tar.gz: d310fe22078eecdf79bf322a0256dc3197cfe638471983429383a08f05946986
3
+ metadata.gz: c1240aeb5f2cdbbe47e63193fa4f09a1a45d621fcc37df7856a97c0e7caaf61f
4
+ data.tar.gz: e9beadd7551793fcad4debe8012f585286e2e1ade6cade8b53707db9d71698fd
5
5
  SHA512:
6
- metadata.gz: 68ab4a40999b28c80de1376cc0a1211d0150a7cac5d55257821d38da7faad43329b46cb7ce725ac19087bff494e007b311e9ebe3ac17f524533c5774118f85eb
7
- data.tar.gz: bee5256b0e182287ad22ac9bc7fdd664d917e7236d187e384e6673d388a42b28bc4a46f9887e7d80673c6783c87b52a99aa9c823a097e43a1c0993b8b7f20f25
6
+ metadata.gz: f6ec11059ed2ef131110ae3a28b4ac0d31baee181a7ddcb860b38edd487e6189eda7b6d1c8a54ea3147ea6171879b8793794728c40f76313885aca4d73a5f6fa
7
+ data.tar.gz: 0f1c645490069e9fb200a130ca9862e2ea7f0a0b461dab591f558d0d7ccd782d34e002ad8b338fa5d0a68141e7053df0280d6560d8955cbf67fc02847843078e
data/knife.gemspec CHANGED
@@ -13,12 +13,12 @@ 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 = ">= 2.7.0"
16
+ s.required_ruby_version = ">= 2.7.0", "< 3.1"
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}"
21
- s.add_dependency "train-core", "~> 3.2", ">= 3.2.28" # 3.2.28 fixes sudo prompts. See https://github.com/chef/chef/pull/9635
18
+ s.add_dependency "chef-config", ">= #{Chef::Knife::VERSION.split(".").first}", "< 18.0"
19
+ s.add_dependency "chef-utils", ">= #{Chef::Knife::VERSION.split(".").first}", "< 18.0"
20
+ s.add_dependency "chef", ">= #{Chef::Knife::VERSION.split(".").first}", "< 18.0"
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"
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency "ohai", "~> 17.0"
27
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
- s.add_dependency "net-ssh", ">= 5.1", "< 7"
29
+ s.add_dependency "net-ssh", ">= 5.1", "< 8"
30
30
  s.add_dependency "net-ssh-multi", "~> 1.2", ">= 1.2.1"
31
31
  s.add_dependency "bcrypt_pbkdf", "~> 1.1" # ed25519 ssh key support
32
32
  # disabling this until we get get it to compile on RHEL 7
@@ -138,7 +138,7 @@ class Chef
138
138
 
139
139
  # @return [String] the path to the user's .chef directory
140
140
  def chef_config_path
141
- @chef_config_path ||= ChefConfig::PathHelper.home(".chef")
141
+ @chef_config_path ||= ChefConfig::PathHelper.home(ChefUtils::Dist::Infra::USER_CONF_DIR)
142
142
  end
143
143
 
144
144
  # @return [String] the full path to the config file (credential file)
@@ -128,6 +128,7 @@ class Chef
128
128
  display_name: "#{user.first_name} #{user.last_name}",
129
129
  email: user.email,
130
130
  password: password,
131
+ create_key: user.create_key,
131
132
  }
132
133
  else
133
134
  user_hash = {
@@ -137,6 +138,7 @@ class Chef
137
138
  display_name: user.display_name,
138
139
  email: user.email,
139
140
  password: password,
141
+ create_key: user.create_key,
140
142
  }
141
143
  end
142
144
 
@@ -159,13 +161,13 @@ class Chef
159
161
  end
160
162
 
161
163
  ui.info("Created #{user.username}")
162
- if final_user["private_key"]
164
+ if final_user["chef_key"] && final_user["chef_key"]["private_key"]
163
165
  if config[:file]
164
166
  File.open(config[:file], "w") do |f|
165
- f.print(final_user["private_key"])
167
+ f.print(final_user["chef_key"]["private_key"])
166
168
  end
167
169
  else
168
- ui.msg final_user["private_key"]
170
+ ui.msg final_user["chef_key"]["private_key"]
169
171
  end
170
172
  end
171
173
  end
@@ -17,7 +17,7 @@
17
17
  class Chef
18
18
  class Knife
19
19
  KNIFE_ROOT = File.expand_path("../..", __dir__)
20
- VERSION = "17.10.0".freeze
20
+ VERSION = "17.10.95".freeze
21
21
  end
22
22
  end
23
23
 
@@ -16,7 +16,6 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
  #
19
-
20
19
  require "knife_spec_helper"
21
20
 
22
21
  Chef::Knife::UserCreate.load_deps
@@ -80,7 +79,7 @@ describe Chef::Knife::UserCreate do
80
79
  before :each do
81
80
  @user = double("Chef::User")
82
81
  @key = "You don't come into cooking to get rich - Ramsay"
83
- allow(@user).to receive(:[]).with("private_key").and_return(@key)
82
+ allow(@user).to receive(:[]).with("chef_key").and_return(@key)
84
83
  knife.config[:passwordprompt] = true
85
84
  knife.name_args = name_args
86
85
  end
@@ -97,7 +96,7 @@ describe Chef::Knife::UserCreate do
97
96
  before do
98
97
  @user = double("Chef::User")
99
98
  @key = "You don't come into cooking to get rich - Ramsay"
100
- allow(@user).to receive(:[]).with("private_key").and_return(@key)
99
+ allow(@user).to receive(:[]).with("chef_key").and_return(@key)
101
100
  knife.name_args = %w{some_user some_display_name some_first_name some_last_name some_email some_password}
102
101
  end
103
102
 
@@ -177,17 +176,39 @@ describe Chef::Knife::UserCreate do
177
176
 
178
177
  describe "with user_name, first_name, last_name, email and password" do
179
178
  let(:name_args) { %w{some_user some_display_name some_first_name some_last_name test@email.com some_password} }
179
+ before :each do
180
+ @user = double("Chef::User")
181
+ expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_root]).and_return(root_rest)
182
+ expect(root_rest).to receive(:post).and_return(@user)
183
+ @key = IO.read(File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"))
184
+ allow(@user).to receive(:[]).with("chef_key").and_return(nil)
185
+ knife.name_args = name_args
186
+ end
187
+
188
+ it "creates an user without private key" do
189
+ expect(knife.ui).to_not receive(:msg).with(@key)
190
+ knife.run
191
+ end
192
+ end
180
193
 
194
+ describe "with user_name, first_name, last_name, email and password" do
195
+ let(:name_args) { %w{some_user some_display_name some_first_name some_last_name test@email.com some_password} }
181
196
  before :each do
182
197
  @user = double("Chef::User")
183
198
  expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_root]).and_return(root_rest)
184
199
  expect(root_rest).to receive(:post).and_return(@user)
185
- @key = "You don't come into cooking to get rich - Ramsay"
186
- allow(@user).to receive(:[]).with("private_key").and_return(@key)
200
+ @username = "Created #{name_args.first}"
201
+ @key = IO.read(File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"))
202
+ allow(@user).to receive(:[]).with("chef_key").and_return("private_key" => @key)
187
203
  knife.name_args = name_args
188
204
  end
189
205
 
190
206
  it "creates an user" do
207
+ expect(knife.ui).to receive(:info).with(@username)
208
+ knife.run
209
+ end
210
+
211
+ it "creates an user private key" do
191
212
  expect(knife.ui).to receive(:msg).with(@key)
192
213
  knife.run
193
214
  end
@@ -204,7 +225,6 @@ describe Chef::Knife::UserCreate do
204
225
  }
205
226
 
206
227
  it "creates an user, associates a user, and adds it to the admins group" do
207
-
208
228
  expect(root_rest).to receive(:post).with("organizations/ramsay/association_requests", request_body).and_return(@user)
209
229
  expect(root_rest).to receive(:put).with("users/some_user/association_requests/1", { response: "accept" })
210
230
  knife.run
@@ -219,14 +239,20 @@ describe Chef::Knife::UserCreate do
219
239
  @user = double("Chef::User")
220
240
  expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_root]).and_return(root_rest)
221
241
  expect(root_rest).to receive(:post).and_return(@user)
222
- @key = "You don't come into cooking to get rich - Ramsay"
223
- allow(@user).to receive(:[]).with("private_key").and_return(@key)
242
+ @username = "Created #{name_args.first}"
243
+ @key = IO.read(File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"))
244
+ allow(@user).to receive(:[]).with("chef_key").and_return("private_key" => @key)
224
245
  knife.name_args = name_args
225
246
  knife.config[:email] = "test@email.com"
226
247
  knife.config[:password] = "some_password"
227
248
  end
228
249
 
229
250
  it "creates an user" do
251
+ expect(knife.ui).to receive(:info).with(@username)
252
+ knife.run
253
+ end
254
+
255
+ it "creates an user private key" do
230
256
  expect(knife.ui).to receive(:msg).with(@key)
231
257
  knife.run
232
258
  end
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: 17.10.0
4
+ version: 17.10.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-09 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '17'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '18.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '17'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '18.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: chef-utils
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +37,9 @@ dependencies:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '17'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '18.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +47,9 @@ dependencies:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: '17'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '18.0'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: chef
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +57,9 @@ dependencies:
45
57
  - - ">="
46
58
  - !ruby/object:Gem::Version
47
59
  version: '17'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '18.0'
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,26 +67,23 @@ dependencies:
52
67
  - - ">="
53
68
  - !ruby/object:Gem::Version
54
69
  version: '17'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '18.0'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: train-core
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
59
77
  - - "~>"
60
78
  - !ruby/object:Gem::Version
61
- version: '3.2'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 3.2.28
79
+ version: '3.10'
65
80
  type: :runtime
66
81
  prerelease: false
67
82
  version_requirements: !ruby/object:Gem::Requirement
68
83
  requirements:
69
84
  - - "~>"
70
85
  - !ruby/object:Gem::Version
71
- version: '3.2'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 3.2.28
86
+ version: '3.10'
75
87
  - !ruby/object:Gem::Dependency
76
88
  name: train-winrm
77
89
  requirement: !ruby/object:Gem::Requirement
@@ -197,7 +209,7 @@ dependencies:
197
209
  version: '5.1'
198
210
  - - "<"
199
211
  - !ruby/object:Gem::Version
200
- version: '7'
212
+ version: '8'
201
213
  type: :runtime
202
214
  prerelease: false
203
215
  version_requirements: !ruby/object:Gem::Requirement
@@ -207,7 +219,7 @@ dependencies:
207
219
  version: '5.1'
208
220
  - - "<"
209
221
  - !ruby/object:Gem::Version
210
- version: '7'
222
+ version: '8'
211
223
  - !ruby/object:Gem::Dependency
212
224
  name: net-ssh-multi
213
225
  requirement: !ruby/object:Gem::Requirement
@@ -1130,13 +1142,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
1130
1142
  - - ">="
1131
1143
  - !ruby/object:Gem::Version
1132
1144
  version: 2.7.0
1145
+ - - "<"
1146
+ - !ruby/object:Gem::Version
1147
+ version: '3.1'
1133
1148
  required_rubygems_version: !ruby/object:Gem::Requirement
1134
1149
  requirements:
1135
1150
  - - ">="
1136
1151
  - !ruby/object:Gem::Version
1137
1152
  version: '0'
1138
1153
  requirements: []
1139
- rubygems_version: 3.2.22
1154
+ rubygems_version: 3.2.33
1140
1155
  signing_key:
1141
1156
  specification_version: 4
1142
1157
  summary: The knife CLI for Chef Infra.