chef 15.7.32-universal-mingw32 → 15.8.23-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef-universal-mingw32.gemspec +1 -1
- data/lib/chef/dsl/declare_resource.rb +9 -9
- data/lib/chef/knife/client_key_create.rb +4 -1
- data/lib/chef/knife/client_key_delete.rb +4 -1
- data/lib/chef/knife/client_key_edit.rb +4 -1
- data/lib/chef/knife/client_key_list.rb +4 -1
- data/lib/chef/knife/client_key_show.rb +4 -1
- data/lib/chef/knife/config_list_profiles.rb +4 -1
- data/lib/chef/knife/config_use_profile.rb +4 -2
- data/lib/chef/knife/configure.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +3 -6
- data/lib/chef/knife/data_bag_from_file.rb +1 -1
- data/lib/chef/knife/exec.rb +4 -1
- data/lib/chef/knife/raw.rb +0 -1
- data/lib/chef/knife/rehash.rb +4 -1
- data/lib/chef/knife/search.rb +1 -1
- data/lib/chef/knife/ssh.rb +3 -3
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/ssl_fetch.rb +1 -1
- data/lib/chef/knife/supermarket_install.rb +1 -1
- data/lib/chef/knife/user_key_create.rb +4 -1
- data/lib/chef/knife/user_key_delete.rb +4 -1
- data/lib/chef/knife/user_key_edit.rb +4 -1
- data/lib/chef/knife/user_key_list.rb +4 -1
- data/lib/chef/knife/user_key_show.rb +4 -1
- data/lib/chef/node/attribute.rb +3 -1
- data/lib/chef/node/common_api.rb +3 -1
- data/lib/chef/provider/ifconfig.rb +13 -4
- data/lib/chef/provider/user/mac.rb +53 -9
- data/lib/chef/resource/notify_group.rb +70 -0
- data/lib/chef/resource/sysctl.rb +26 -2
- data/lib/chef/resource/user/mac_user.rb +4 -1
- data/lib/chef/resource/windows_task.rb +2 -1
- data/lib/chef/resources.rb +2 -1
- data/lib/chef/search/query.rb +1 -1
- data/lib/chef/shell.rb +4 -5
- data/lib/chef/shell/ext.rb +3 -5
- data/lib/chef/version.rb +1 -1
- data/spec/unit/cookbook_uploader_spec.rb +1 -0
- data/spec/unit/knife/cookbook_upload_spec.rb +2 -2
- data/spec/unit/provider/ifconfig_spec.rb +43 -14
- data/spec/unit/resource/notify_group_spec.rb +34 -0
- data/spec/unit/resource/sysctl_spec.rb +23 -1
- data/spec/unit/search/query_spec.rb +8 -1
- metadata +10 -8
data/lib/chef/search/query.rb
CHANGED
data/lib/chef/shell.rb
CHANGED
@@ -159,11 +159,10 @@ module Shell
|
|
159
159
|
|
160
160
|
puts "run `help' for help, `exit' or ^D to quit."
|
161
161
|
puts
|
162
|
-
puts "Ohai2u#{greeting}!"
|
163
162
|
end
|
164
163
|
|
165
164
|
def self.greeting
|
166
|
-
"
|
165
|
+
"#{Etc.getlogin}@#{Shell.session.node["fqdn"]}"
|
167
166
|
rescue NameError, ArgumentError
|
168
167
|
""
|
169
168
|
end
|
@@ -241,7 +240,7 @@ module Shell
|
|
241
240
|
option :standalone,
|
242
241
|
short: "-a",
|
243
242
|
long: "--standalone",
|
244
|
-
description: "
|
243
|
+
description: "Standalone session",
|
245
244
|
default: true,
|
246
245
|
boolean: true
|
247
246
|
|
@@ -255,7 +254,7 @@ module Shell
|
|
255
254
|
option :client,
|
256
255
|
short: "-z",
|
257
256
|
long: "--client",
|
258
|
-
description: "#{Chef::Dist::
|
257
|
+
description: "#{Chef::Dist::PRODUCT} session",
|
259
258
|
boolean: true
|
260
259
|
|
261
260
|
option :solo_legacy_shell,
|
@@ -273,7 +272,7 @@ module Shell
|
|
273
272
|
option :chef_server_url,
|
274
273
|
short: "-S CHEFSERVERURL",
|
275
274
|
long: "--server CHEFSERVERURL",
|
276
|
-
description: "The #{Chef::Dist::
|
275
|
+
description: "The #{Chef::Dist::SERVER_PRODUCT} URL",
|
277
276
|
proc: nil
|
278
277
|
|
279
278
|
option :version,
|
data/lib/chef/shell/ext.rb
CHANGED
@@ -204,16 +204,14 @@ module Shell
|
|
204
204
|
else
|
205
205
|
puts help_banner
|
206
206
|
end
|
207
|
-
:
|
207
|
+
:help
|
208
208
|
end
|
209
209
|
alias :halp :help
|
210
210
|
|
211
211
|
desc "prints information about #{Chef::Dist::PRODUCT}"
|
212
212
|
def version
|
213
|
-
puts "
|
214
|
-
"
|
215
|
-
" #{Chef::Dist::WEBSITE}\n" +
|
216
|
-
" https://docs.chef.io/"
|
213
|
+
puts "Welcome to the #{Chef::Dist::SHELL} #{::Chef::VERSION}\n" +
|
214
|
+
"For usage see https://docs.chef.io/chef_shell.html"
|
217
215
|
:ucanhaz_automation
|
218
216
|
end
|
219
217
|
alias :shell :version
|
data/lib/chef/version.rb
CHANGED
@@ -325,7 +325,7 @@ describe Chef::Knife::CookbookUpload do
|
|
325
325
|
it "should warn users that no cookbooks exist" do
|
326
326
|
knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
|
327
327
|
expect(knife.ui).to receive(:warn).with(
|
328
|
-
/Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./
|
328
|
+
/Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path].join(', ')}'\. Use --cookbook-path to specify the desired path\./
|
329
329
|
)
|
330
330
|
knife.run
|
331
331
|
end
|
@@ -335,7 +335,7 @@ describe Chef::Knife::CookbookUpload do
|
|
335
335
|
it "should warn users that no cookbooks exist" do
|
336
336
|
knife.config[:cookbook_path] = "/chef-repo/cookbooks"
|
337
337
|
expect(knife.ui).to receive(:warn).with(
|
338
|
-
/Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./
|
338
|
+
/Could not find any cookbooks in your cookbook path: '#{knife.config[:cookbook_path]}'\. Use --cookbook-path to specify the desired path\./
|
339
339
|
)
|
340
340
|
knife.run
|
341
341
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Prajakta Purohit (prajakta@chef.io)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-2020, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -46,19 +46,48 @@ describe Chef::Provider::Ifconfig do
|
|
46
46
|
ifconfig 1.42 (2001-04-13)
|
47
47
|
EOS
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
49
|
+
let(:net_tools_version2) { StringIO.new <<~EOS }
|
50
|
+
net-tools 2.10-alpha
|
51
|
+
EOS
|
52
|
+
|
53
|
+
context "when ifconfig returns its version on stdout" do
|
54
|
+
before do
|
55
|
+
ifconfig = double(stdout: "", exitstatus: 1)
|
56
|
+
allow(@provider).to receive(:shell_out_compacted).and_return(ifconfig)
|
57
|
+
ifconfig_version = double(stdout: net_tools_version2, stderr: "", exitstatus: 4)
|
58
|
+
allow(@provider).to receive(:shell_out_compacted).with("ifconfig", "--version").and_return(ifconfig_version)
|
59
|
+
@provider.load_current_resource
|
60
|
+
end
|
61
|
+
it "should track state of ifconfig failure" do
|
62
|
+
expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
|
63
|
+
end
|
64
|
+
it "should thrown an exception when ifconfig fails" do
|
65
|
+
@provider.define_resource_requirements
|
66
|
+
expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
|
67
|
+
end
|
68
|
+
it "should grab the correct major.minor version of net-tools" do
|
69
|
+
expect(@provider.ifconfig_version).to eql("2.10")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "when ifconfig returns its version on stderr" do
|
74
|
+
before do
|
75
|
+
ifconfig = double(stdout: "", exitstatus: 1)
|
76
|
+
allow(@provider).to receive(:shell_out_compacted).and_return(ifconfig)
|
77
|
+
ifconfig_version = double(stdout: "", stderr: net_tools_version, exitstatus: 4)
|
78
|
+
allow(@provider).to receive(:shell_out_compacted).with("ifconfig", "--version").and_return(ifconfig_version)
|
79
|
+
@provider.load_current_resource
|
80
|
+
end
|
81
|
+
it "should track state of ifconfig failure" do
|
82
|
+
expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
|
83
|
+
end
|
84
|
+
it "should thrown an exception when ifconfig fails" do
|
85
|
+
@provider.define_resource_requirements
|
86
|
+
expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
|
87
|
+
end
|
88
|
+
it "should grab the correct major.minor version of net-tools" do
|
89
|
+
expect(@provider.ifconfig_version).to eql("1.60")
|
90
|
+
end
|
62
91
|
end
|
63
92
|
end
|
64
93
|
describe Chef::Provider::Ifconfig, "action_add" do
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: 2019-2020, Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "spec_helper"
|
19
|
+
|
20
|
+
describe Chef::Resource::NotifyGroup do
|
21
|
+
let(:node) { Chef::Node.new }
|
22
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
23
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
24
|
+
let(:resource) { Chef::Resource::NotifyGroup.new("whatever", run_context) }
|
25
|
+
|
26
|
+
it "sets the default action as :run" do
|
27
|
+
expect(resource.action).to eql([:nothing])
|
28
|
+
end
|
29
|
+
|
30
|
+
it "is always updated" do
|
31
|
+
resource.run_action(:run)
|
32
|
+
expect(resource.updated_by_last_action?).to be true
|
33
|
+
end
|
34
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright 2018, Chef Software, Inc.
|
2
|
+
# Copyright:: Copyright 2018-2020, Chef Software, Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -19,6 +19,7 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::Resource::Sysctl do
|
21
21
|
let(:resource) { Chef::Resource::Sysctl.new("fakey_fakerton") }
|
22
|
+
let(:provider) { resource.provider_for_action(:create) }
|
22
23
|
|
23
24
|
it "sets resource name as :sysctl" do
|
24
25
|
expect(resource.resource_name).to eql(:sysctl)
|
@@ -51,4 +52,25 @@ describe Chef::Resource::Sysctl do
|
|
51
52
|
resource.value 1.1
|
52
53
|
expect(resource.value).to eql("1.1")
|
53
54
|
end
|
55
|
+
|
56
|
+
context "#contruct_sysctl_content" do
|
57
|
+
before do
|
58
|
+
resource.key("foo")
|
59
|
+
resource.value("bar")
|
60
|
+
end
|
61
|
+
|
62
|
+
context "when comment is a String" do
|
63
|
+
it "Returns content for use with a file resource" do
|
64
|
+
resource.comment("This sets foo / bar on our system")
|
65
|
+
expect(provider.contruct_sysctl_content).to eql("# This sets foo / bar on our system\nfoo = bar")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "when comment is an Array" do
|
70
|
+
it "Returns content for use with a file resource" do
|
71
|
+
resource.comment(["This sets foo / bar on our system", "We need for baz"])
|
72
|
+
expect(provider.contruct_sysctl_content).to eql("# This sets foo / bar on our system\n# We need for baz\nfoo = bar")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
54
76
|
end
|
@@ -233,13 +233,20 @@ describe Chef::Search::Query do
|
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
236
|
-
it "fuzzifies node searches when fuzz is set" do
|
236
|
+
it "fuzzifies node searches when fuzz is set and type is a symbol" do
|
237
237
|
expect(rest).to receive(:get).with(
|
238
238
|
"search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0&rows=#{default_rows}"
|
239
239
|
).and_return(response)
|
240
240
|
query.search(:node, "free.messi", fuzz: true)
|
241
241
|
end
|
242
242
|
|
243
|
+
it "fuzzifies node searches when fuzz is set and type is a string" do
|
244
|
+
expect(rest).to receive(:get).with(
|
245
|
+
"search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0&rows=#{default_rows}"
|
246
|
+
).and_return(response)
|
247
|
+
query.search("node", "free.messi", fuzz: true)
|
248
|
+
end
|
249
|
+
|
243
250
|
it "does not fuzzify node searches when fuzz is not set" do
|
244
251
|
expect(rest).to receive(:get).with(
|
245
252
|
"search/node?q=free.messi&start=0&rows=#{default_rows}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 15.
|
4
|
+
version: 15.8.23
|
5
5
|
platform: universal-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 15.
|
19
|
+
version: 15.8.23
|
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: 15.
|
26
|
+
version: 15.8.23
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: chef-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 15.
|
33
|
+
version: 15.8.23
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 15.
|
40
|
+
version: 15.8.23
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -620,7 +620,7 @@ dependencies:
|
|
620
620
|
requirements:
|
621
621
|
- - ">="
|
622
622
|
- !ruby/object:Gem::Version
|
623
|
-
version: 2.1.
|
623
|
+
version: 2.1.5
|
624
624
|
- - "<"
|
625
625
|
- !ruby/object:Gem::Version
|
626
626
|
version: '3.0'
|
@@ -630,7 +630,7 @@ dependencies:
|
|
630
630
|
requirements:
|
631
631
|
- - ">="
|
632
632
|
- !ruby/object:Gem::Version
|
633
|
-
version: 2.1.
|
633
|
+
version: 2.1.5
|
634
634
|
- - "<"
|
635
635
|
- !ruby/object:Gem::Version
|
636
636
|
version: '3.0'
|
@@ -1400,6 +1400,7 @@ files:
|
|
1400
1400
|
- lib/chef/resource/mdadm.rb
|
1401
1401
|
- lib/chef/resource/mount.rb
|
1402
1402
|
- lib/chef/resource/msu_package.rb
|
1403
|
+
- lib/chef/resource/notify_group.rb
|
1403
1404
|
- lib/chef/resource/ohai.rb
|
1404
1405
|
- lib/chef/resource/ohai_hint.rb
|
1405
1406
|
- lib/chef/resource/openbsd_package.rb
|
@@ -2655,6 +2656,7 @@ files:
|
|
2655
2656
|
- spec/unit/resource/mdadm_spec.rb
|
2656
2657
|
- spec/unit/resource/mount_spec.rb
|
2657
2658
|
- spec/unit/resource/msu_package_spec.rb
|
2659
|
+
- spec/unit/resource/notify_group_spec.rb
|
2658
2660
|
- spec/unit/resource/ohai_hint_spec.rb
|
2659
2661
|
- spec/unit/resource/ohai_spec.rb
|
2660
2662
|
- spec/unit/resource/openbsd_package_spec.rb
|