chef 15.13.8 → 15.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +16 -1
- data/lib/chef/provider/service/arch.rb +2 -2
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +1 -1
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/resource/hostname.rb +18 -18
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/windows_feature_powershell.rb +6 -2
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/spec/functional/resource/aixinit_service_spec.rb +7 -7
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/insserv_spec.rb +4 -4
- data/spec/functional/resource/link_spec.rb +17 -17
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +1 -1
- data/spec/functional/resource/user/mac_user_spec.rb +1 -1
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -4
- data/spec/support/platform_helpers.rb +12 -42
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +2 -2
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/knife/bootstrap_spec.rb +14 -14
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/role_spec.rb +11 -11
- metadata +7 -6
@@ -86,7 +86,7 @@ describe Chef::Provider::Service::Macosx do
|
|
86
86
|
.with(/(#{su_cmd} '#{cmd}'|#{cmd})/, default_env: false)
|
87
87
|
.and_return(double("Status",
|
88
88
|
stdout: launchctl_stdout, exitstatus: 0))
|
89
|
-
allow(File).to receive(:
|
89
|
+
allow(File).to receive(:exist?).and_return([true], [])
|
90
90
|
allow(provider).to receive(:shell_out!)
|
91
91
|
.with(/plutil -convert xml1 -o/, default_env: false)
|
92
92
|
.and_return(double("Status", stdout: plutil_stdout))
|
@@ -112,7 +112,7 @@ describe Chef::Provider::Service::Macosx do
|
|
112
112
|
|
113
113
|
before do
|
114
114
|
allow(Dir).to receive(:glob).and_return([])
|
115
|
-
allow(File).to receive(:
|
115
|
+
allow(File).to receive(:exist?).and_return([true], [])
|
116
116
|
allow(provider).to receive(:shell_out!)
|
117
117
|
.with(/plutil -convert xml1 -o/)
|
118
118
|
.and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
@@ -168,7 +168,7 @@ describe Chef::Provider::Service::Macosx do
|
|
168
168
|
describe "running unsupported actions" do
|
169
169
|
before do
|
170
170
|
allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
|
171
|
-
allow(File).to receive(:
|
171
|
+
allow(File).to receive(:exist?).and_return([true], [])
|
172
172
|
end
|
173
173
|
it "should throw an exception when reload action is attempted" do
|
174
174
|
expect { provider.run_action(:reload) }.to raise_error(Chef::Exceptions::UnsupportedAction)
|
@@ -21,7 +21,7 @@ require "ostruct"
|
|
21
21
|
|
22
22
|
shared_examples_for "define_resource_requirements_common" do
|
23
23
|
it "should raise an error if /sbin/chkconfig does not exist" do
|
24
|
-
allow(File).to receive(:
|
24
|
+
allow(File).to receive(:exist?).with("/sbin/chkconfig").and_return(false)
|
25
25
|
allow(@provider).to receive(:shell_out).with("/sbin/service chef status").and_raise(Errno::ENOENT)
|
26
26
|
allow(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_raise(Errno::ENOENT)
|
27
27
|
@provider.load_current_resource
|
@@ -55,7 +55,7 @@ describe "Chef::Provider::Service::Redhat" do
|
|
55
55
|
@provider = Chef::Provider::Service::Redhat.new(@new_resource, @run_context)
|
56
56
|
@provider.action = :start
|
57
57
|
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
|
58
|
-
allow(File).to receive(:
|
58
|
+
allow(File).to receive(:exist?).with("/sbin/chkconfig").and_return(true)
|
59
59
|
end
|
60
60
|
|
61
61
|
describe "while not in why run mode" do
|
@@ -74,7 +74,7 @@ describe Chef::Provider::Service::Upstart do
|
|
74
74
|
@status = double("Status", exitstatus: 0, stdout: "", stderr: "")
|
75
75
|
allow(@provider).to receive(:shell_out).and_return(@status)
|
76
76
|
|
77
|
-
allow(::File).to receive(:
|
77
|
+
allow(::File).to receive(:exist?).and_return(true)
|
78
78
|
allow(::File).to receive(:open).and_return(true)
|
79
79
|
end
|
80
80
|
|
@@ -181,13 +181,13 @@ describe Chef::Provider::Service::Upstart do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
it "should assume disable when no job configuration file is found" do
|
184
|
-
allow(::File).to receive(:
|
184
|
+
allow(::File).to receive(:exist?).and_return(false)
|
185
185
|
expect(@current_resource).to receive(:running).with(false)
|
186
186
|
@provider.load_current_resource
|
187
187
|
end
|
188
188
|
|
189
189
|
it "should track state when the upstart configuration file fails to load" do
|
190
|
-
expect(File).to receive(:
|
190
|
+
expect(File).to receive(:exist?).and_return false
|
191
191
|
@provider.load_current_resource
|
192
192
|
expect(@provider.instance_variable_get("@config_file_found")).to eq(false)
|
193
193
|
end
|
@@ -22,6 +22,7 @@ describe Chef::Resource::WindowsFeaturePowershell do
|
|
22
22
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
23
23
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
24
24
|
let(:resource) { Chef::Resource::WindowsFeaturePowershell.new(%w{SNMP DHCP}, run_context) }
|
25
|
+
let(:provider) { resource.provider_for_action(:install) }
|
25
26
|
|
26
27
|
it "sets resource name as :windows_feature_powershell" do
|
27
28
|
expect(resource.resource_name).to eql(:windows_feature_powershell)
|
@@ -36,10 +37,6 @@ describe Chef::Resource::WindowsFeaturePowershell do
|
|
36
37
|
expect(resource.feature_name).to eql(%w{snmp dhcp})
|
37
38
|
end
|
38
39
|
|
39
|
-
it "sets the default action as :install" do
|
40
|
-
expect(resource.action).to eql([:install])
|
41
|
-
end
|
42
|
-
|
43
40
|
it "supports :delete, :install, :remove actions" do
|
44
41
|
expect { resource.action :delete }.not_to raise_error
|
45
42
|
expect { resource.action :install }.not_to raise_error
|
@@ -69,4 +66,33 @@ describe Chef::Resource::WindowsFeaturePowershell do
|
|
69
66
|
resource.feature_name "SNMP"
|
70
67
|
expect(resource.feature_name).to eql(["SNMP"])
|
71
68
|
end
|
69
|
+
|
70
|
+
it "install a single feature" do
|
71
|
+
resource.feature_name "snmp"
|
72
|
+
expect { resource.action :install }.not_to raise_error
|
73
|
+
end
|
74
|
+
|
75
|
+
it "install multi feature" do
|
76
|
+
resource.feature_name "SNMP, DHCP"
|
77
|
+
expect { resource.action :install }.not_to raise_error
|
78
|
+
end
|
79
|
+
|
80
|
+
it "does not attempt to install features that have been removed" do
|
81
|
+
node.default["powershell_features_cache"] ||= {}
|
82
|
+
node.default["powershell_features_cache"]["disabled"] = ["dhcp"]
|
83
|
+
node.default["powershell_features_cache"]["removed"] = ["snmp"]
|
84
|
+
resource.feature_name "dhcp, snmp"
|
85
|
+
|
86
|
+
expect(provider.features_to_install).to eq(["dhcp"])
|
87
|
+
end
|
88
|
+
|
89
|
+
it "attempts to install features that have been removed when source is set" do
|
90
|
+
node.default["powershell_features_cache"] ||= {}
|
91
|
+
node.default["powershell_features_cache"]["disabled"] = ["dhcp"]
|
92
|
+
node.default["powershell_features_cache"]["removed"] = ["snmp"]
|
93
|
+
resource.feature_name "dhcp, snmp"
|
94
|
+
resource.source 'D:\\sources\\sxs'
|
95
|
+
|
96
|
+
expect(provider.features_to_install).to eq(%w{dhcp snmp})
|
97
|
+
end
|
72
98
|
end
|
data/spec/unit/role_spec.rb
CHANGED
@@ -259,7 +259,7 @@ describe Chef::Role do
|
|
259
259
|
it "should return a Chef::Role object from JSON" do
|
260
260
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json"])
|
261
261
|
file_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
|
262
|
-
expect(File).to receive(:
|
262
|
+
expect(File).to receive(:exist?).with(file_path).exactly(1).times.and_return(true)
|
263
263
|
expect(IO).to receive(:read).with(file_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
|
264
264
|
expect(@role).to be_a_kind_of(Chef::Role)
|
265
265
|
@role.class.from_disk("lolcat")
|
@@ -268,7 +268,7 @@ describe Chef::Role do
|
|
268
268
|
it "should return a Chef::Role object from a Ruby DSL" do
|
269
269
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
|
270
270
|
rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
|
271
|
-
expect(File).to receive(:
|
271
|
+
expect(File).to receive(:exist?).with(rb_path).exactly(1).times.and_return(true)
|
272
272
|
expect(File).to receive(:readable?).with(rb_path).exactly(1).times.and_return(true)
|
273
273
|
expect(File).to receive(:file?).with(rb_path).exactly(1).times.and_return(true)
|
274
274
|
expect(IO).to receive(:read).with(rb_path).and_return(ROLE_DSL)
|
@@ -280,8 +280,8 @@ describe Chef::Role do
|
|
280
280
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
|
281
281
|
js_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
|
282
282
|
rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
|
283
|
-
expect(File).to receive(:
|
284
|
-
expect(File).not_to receive(:
|
283
|
+
expect(File).to receive(:exist?).with(js_path).exactly(1).times.and_return(true)
|
284
|
+
expect(File).not_to receive(:exist?).with(rb_path)
|
285
285
|
expect(IO).to receive(:read).with(js_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
|
286
286
|
expect(@role).to be_a_kind_of(Chef::Role)
|
287
287
|
@role.class.from_disk("lolcat")
|
@@ -289,19 +289,19 @@ describe Chef::Role do
|
|
289
289
|
|
290
290
|
it "should raise an exception if the file does not exist" do
|
291
291
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/meme.rb"])
|
292
|
-
expect(File).not_to receive(:
|
292
|
+
expect(File).not_to receive(:exist?)
|
293
293
|
expect { @role.class.from_disk("lolcat") }.to raise_error(Chef::Exceptions::RoleNotFound)
|
294
294
|
end
|
295
295
|
|
296
296
|
it "should raise an exception if two files exist with the same name" do
|
297
297
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/lolcat.rb"])
|
298
|
-
expect(File).not_to receive(:
|
298
|
+
expect(File).not_to receive(:exist?)
|
299
299
|
expect { @role.class.from_disk("lolcat") }.to raise_error(Chef::Exceptions::DuplicateRole)
|
300
300
|
end
|
301
301
|
|
302
302
|
it "should not raise an exception if two files exist with a similar name" do
|
303
303
|
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/super_lolcat.rb"])
|
304
|
-
expect(File).to receive(:
|
304
|
+
expect(File).to receive(:exist?).with("#{Chef::Config[:role_path]}/memes/lolcat.rb").and_return(true)
|
305
305
|
allow_any_instance_of(Chef::Role).to receive(:from_file).with("#{Chef::Config[:role_path]}/memes/lolcat.rb")
|
306
306
|
expect { @role.class.from_disk("lolcat") }.not_to raise_error
|
307
307
|
end
|
@@ -315,7 +315,7 @@ describe Chef::Role do
|
|
315
315
|
|
316
316
|
it "should return a Chef::Role object from JSON" do
|
317
317
|
expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.json"])
|
318
|
-
expect(File).to receive(:
|
318
|
+
expect(File).to receive(:exist?).with("/path1/lolcat.json").exactly(1).times.and_return(true)
|
319
319
|
expect(IO).to receive(:read).with("/path1/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
|
320
320
|
expect(@role).to be_a_kind_of(Chef::Role)
|
321
321
|
@role.class.from_disk("lolcat")
|
@@ -324,7 +324,7 @@ describe Chef::Role do
|
|
324
324
|
it "should return a Chef::Role object from JSON when role is in the second path" do
|
325
325
|
expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
|
326
326
|
expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.json"])
|
327
|
-
expect(File).to receive(:
|
327
|
+
expect(File).to receive(:exist?).with("/path/path2/lolcat.json").exactly(1).times.and_return(true)
|
328
328
|
expect(IO).to receive(:read).with("/path/path2/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
|
329
329
|
expect(@role).to be_a_kind_of(Chef::Role)
|
330
330
|
@role.class.from_disk("lolcat")
|
@@ -332,7 +332,7 @@ describe Chef::Role do
|
|
332
332
|
|
333
333
|
it "should return a Chef::Role object from a Ruby DSL" do
|
334
334
|
expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.rb"])
|
335
|
-
expect(File).to receive(:
|
335
|
+
expect(File).to receive(:exist?).with("/path1/lolcat.rb").exactly(1).times.and_return(true)
|
336
336
|
expect(File).to receive(:readable?).with("/path1/lolcat.rb").and_return(true)
|
337
337
|
expect(File).to receive(:file?).with("/path1/lolcat.rb").and_return(true)
|
338
338
|
expect(IO).to receive(:read).with("/path1/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
|
@@ -343,7 +343,7 @@ describe Chef::Role do
|
|
343
343
|
it "should return a Chef::Role object from a Ruby DSL when role is in the second path" do
|
344
344
|
expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
|
345
345
|
expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.rb"])
|
346
|
-
expect(File).to receive(:
|
346
|
+
expect(File).to receive(:exist?).with("/path/path2/lolcat.rb").exactly(1).times.and_return(true)
|
347
347
|
expect(File).to receive(:readable?).with("/path/path2/lolcat.rb").and_return(true)
|
348
348
|
expect(File).to receive(:file?).with("/path/path2/lolcat.rb").and_return(true)
|
349
349
|
expect(IO).to receive(:read).with("/path/path2/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
|
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.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-11 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.14.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: 15.
|
26
|
+
version: 15.14.0
|
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.14.0
|
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.14.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: train-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1898,6 +1898,7 @@ files:
|
|
1898
1898
|
- spec/functional/resource/user/windows_spec.rb
|
1899
1899
|
- spec/functional/resource/windows_certificate_spec.rb
|
1900
1900
|
- spec/functional/resource/windows_env_spec.rb
|
1901
|
+
- spec/functional/resource/windows_font_spec.rb
|
1901
1902
|
- spec/functional/resource/windows_package_spec.rb
|
1902
1903
|
- spec/functional/resource/windows_path_spec.rb
|
1903
1904
|
- spec/functional/resource/windows_service_spec.rb
|