chef 15.13.8-universal-mingw32 → 15.14.0-universal-mingw32
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
data/lib/chef/shell.rb
CHANGED
@@ -317,7 +317,7 @@ module Shell
|
|
317
317
|
config[:config_file] = config_file_for_shell_mode(environment)
|
318
318
|
config_msg = config[:config_file] || "none (standalone session)"
|
319
319
|
puts "loading configuration: #{config_msg}"
|
320
|
-
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.
|
320
|
+
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exist?(config[:config_file]) && File.readable?(config[:config_file])
|
321
321
|
Chef::Config.merge!(config)
|
322
322
|
end
|
323
323
|
|
data/lib/chef/util/diff.rb
CHANGED
@@ -64,7 +64,7 @@ class Chef
|
|
64
64
|
|
65
65
|
def use_tempfile_if_missing(file)
|
66
66
|
tempfile = nil
|
67
|
-
unless File.
|
67
|
+
unless File.exist?(file)
|
68
68
|
Chef::Log.trace("File #{file} does not exist to diff against, using empty tempfile")
|
69
69
|
tempfile = Tempfile.new("chef-diff")
|
70
70
|
file = tempfile.path
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/file.rb
CHANGED
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
def self.symlink?(file_name)
|
79
79
|
is_symlink = false
|
80
80
|
path = encode_path(file_name)
|
81
|
-
if ::File.
|
81
|
+
if ::File.exist?(file_name) || ::File.symlink?(file_name)
|
82
82
|
if (GetFileAttributesW(path) & FILE_ATTRIBUTE_REPARSE_POINT) > 0
|
83
83
|
file_search_handle(file_name) do |handle, find_data|
|
84
84
|
if find_data[:dw_reserved_0] == IO_REPARSE_TAG_SYMLINK
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
# will raise a NotImplementedError, as per MRI.
|
105
105
|
#
|
106
106
|
def self.readlink(link_name)
|
107
|
-
raise Errno::ENOENT, link_name unless ::File.
|
107
|
+
raise Errno::ENOENT, link_name unless ::File.exist?(link_name) || ::File.symlink?(link_name)
|
108
108
|
|
109
109
|
symlink_file_handle(link_name) do |handle|
|
110
110
|
# Go to DeviceIoControl to get the symlink information
|
@@ -28,11 +28,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
28
28
|
# Platform specific validation routines.
|
29
29
|
def service_should_be_started(file_name)
|
30
30
|
# The existence of this file indicates that the service was started.
|
31
|
-
expect(File.
|
31
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
|
32
32
|
end
|
33
33
|
|
34
34
|
def service_should_be_stopped(file_name)
|
35
|
-
expect(File.
|
35
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
|
36
36
|
end
|
37
37
|
|
38
38
|
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
|
@@ -68,12 +68,12 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
before(:all) do
|
71
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
71
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
72
72
|
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
|
73
73
|
end
|
74
74
|
|
75
75
|
after(:all) do
|
76
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
76
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
77
77
|
end
|
78
78
|
|
79
79
|
before(:each) do
|
@@ -165,7 +165,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
165
165
|
end
|
166
166
|
|
167
167
|
after do
|
168
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
168
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
169
169
|
end
|
170
170
|
|
171
171
|
it "creates symlink with status K" do
|
@@ -181,7 +181,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
after do
|
184
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
184
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
185
185
|
end
|
186
186
|
|
187
187
|
it "creates a symlink with status K and a priority" do
|
@@ -198,7 +198,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
after do
|
201
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
201
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
202
202
|
end
|
203
203
|
|
204
204
|
it "create symlink with status stop (K) and a priority " do
|
@@ -31,12 +31,12 @@ describe Chef::Resource::BffPackage, :requires_root, external: ohai[:platform] !
|
|
31
31
|
|
32
32
|
def bff_pkg_should_be_installed(resource)
|
33
33
|
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(0)
|
34
|
-
::File.
|
34
|
+
::File.exist?("/usr/PkgA/bin/acommand")
|
35
35
|
end
|
36
36
|
|
37
37
|
def bff_pkg_should_be_removed(resource)
|
38
38
|
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(1)
|
39
|
-
!::File.
|
39
|
+
!::File.exist?("/usr/PkgA/bin/acommand")
|
40
40
|
end
|
41
41
|
|
42
42
|
before(:all) do
|
@@ -72,7 +72,7 @@ describe Chef::Resource::CookbookFile do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
after do
|
75
|
-
FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.
|
75
|
+
FileUtils.rm_r(windows_non_temp_dir) if ChefUtils.windows? && File.exist?(windows_non_temp_dir)
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -62,7 +62,7 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
after do
|
65
|
-
File.delete(tmp_file_name) if File.
|
65
|
+
File.delete(tmp_file_name) if File.exist? tmp_file_name
|
66
66
|
end
|
67
67
|
|
68
68
|
it "converges the resource if it is not converged" do
|
@@ -39,11 +39,11 @@ describe Chef::Resource::Service, :requires_root, :sles11 do
|
|
39
39
|
# Platform specific validation routines.
|
40
40
|
def service_should_be_started(file_name)
|
41
41
|
# The existence of this file indicates that the service was started.
|
42
|
-
expect(File.
|
42
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
|
43
43
|
end
|
44
44
|
|
45
45
|
def service_should_be_stopped(file_name)
|
46
|
-
expect(File.
|
46
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
|
47
47
|
end
|
48
48
|
|
49
49
|
def delete_test_files
|
@@ -72,13 +72,13 @@ describe Chef::Resource::Service, :requires_root, :sles11 do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
before(:all) do
|
75
|
-
File.delete("/etc/init.d/inittest") if File.
|
75
|
+
File.delete("/etc/init.d/inittest") if File.exist?("/etc/init.d/inittest")
|
76
76
|
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/inittest")).to_s, "/etc/init.d/inittest")
|
77
77
|
FileUtils.chmod(0755, "/etc/init.d/inittest")
|
78
78
|
end
|
79
79
|
|
80
80
|
after(:all) do
|
81
|
-
File.delete("/etc/init.d/inittest") if File.
|
81
|
+
File.delete("/etc/init.d/inittest") if File.exist?("/etc/init.d/inittest")
|
82
82
|
end
|
83
83
|
|
84
84
|
before(:each) do
|
@@ -56,9 +56,9 @@ describe Chef::Resource::Link do
|
|
56
56
|
|
57
57
|
after(:each) do
|
58
58
|
begin
|
59
|
-
cleanup_link(to) if File.
|
60
|
-
cleanup_link(target_file) if File.
|
61
|
-
cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.
|
59
|
+
cleanup_link(to) if File.exist?(to)
|
60
|
+
cleanup_link(target_file) if File.exist?(target_file)
|
61
|
+
cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.exist?(CHEF_SPEC_BACKUP_PATH)
|
62
62
|
rescue
|
63
63
|
puts "Could not remove a file: #{$!}"
|
64
64
|
end
|
@@ -276,7 +276,7 @@ describe Chef::Resource::Link do
|
|
276
276
|
resource.run_action(:create)
|
277
277
|
end
|
278
278
|
it "preserves the hard link" do
|
279
|
-
expect(File.
|
279
|
+
expect(File.exist?(target_file)).to be_truthy
|
280
280
|
expect(symlink?(target_file)).to be_falsey
|
281
281
|
# Writing to one hardlinked file should cause both
|
282
282
|
# to have the new value.
|
@@ -301,7 +301,7 @@ describe Chef::Resource::Link do
|
|
301
301
|
resource.run_action(:create)
|
302
302
|
end
|
303
303
|
it "links to the target file" do
|
304
|
-
expect(File.
|
304
|
+
expect(File.exist?(target_file)).to be_truthy
|
305
305
|
expect(symlink?(target_file)).to be_falsey
|
306
306
|
# Writing to one hardlinked file should cause both
|
307
307
|
# to have the new value.
|
@@ -341,7 +341,7 @@ describe Chef::Resource::Link do
|
|
341
341
|
include_context "delete succeeds"
|
342
342
|
it "the :delete action does not delete the target file" do
|
343
343
|
resource.run_action(:delete)
|
344
|
-
expect(File.
|
344
|
+
expect(File.exist?(to)).to be_truthy
|
345
345
|
end
|
346
346
|
end
|
347
347
|
context "pointing somewhere else", :requires_root_or_running_windows do
|
@@ -369,7 +369,7 @@ describe Chef::Resource::Link do
|
|
369
369
|
include_context "delete succeeds"
|
370
370
|
it "the :delete action does not delete the target file" do
|
371
371
|
resource.run_action(:delete)
|
372
|
-
expect(File.
|
372
|
+
expect(File.exist?(to)).to be_truthy
|
373
373
|
end
|
374
374
|
end
|
375
375
|
context "pointing nowhere" do
|
@@ -386,7 +386,7 @@ describe Chef::Resource::Link do
|
|
386
386
|
context "and the link already exists and is a hard link to the file" do
|
387
387
|
before(:each) do
|
388
388
|
link(to, target_file)
|
389
|
-
expect(File.
|
389
|
+
expect(File.exist?(target_file)).to be_truthy
|
390
390
|
expect(symlink?(target_file)).to be_falsey
|
391
391
|
end
|
392
392
|
include_context "create symbolic link succeeds"
|
@@ -406,7 +406,7 @@ describe Chef::Resource::Link do
|
|
406
406
|
it "create errors out" do
|
407
407
|
if windows?
|
408
408
|
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
|
409
|
-
elsif
|
409
|
+
elsif macos? || solaris? || freebsd? || aix?
|
410
410
|
expect { resource.run_action(:create) }.to raise_error(Errno::EPERM)
|
411
411
|
else
|
412
412
|
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
|
@@ -585,14 +585,14 @@ describe Chef::Resource::Link do
|
|
585
585
|
context "and the link already exists and is a hard link to the file" do
|
586
586
|
before(:each) do
|
587
587
|
link(to, target_file)
|
588
|
-
expect(File.
|
588
|
+
expect(File.exist?(target_file)).to be_truthy
|
589
589
|
expect(symlink?(target_file)).to be_falsey
|
590
590
|
end
|
591
591
|
include_context "create hard link is noop"
|
592
592
|
include_context "delete succeeds"
|
593
593
|
it "the :delete action does not delete the target file" do
|
594
594
|
resource.run_action(:delete)
|
595
|
-
expect(File.
|
595
|
+
expect(File.exist?(to)).to be_truthy
|
596
596
|
end
|
597
597
|
end
|
598
598
|
context "and the link already exists and is a file" do
|
@@ -609,7 +609,7 @@ describe Chef::Resource::Link do
|
|
609
609
|
it "errors out" do
|
610
610
|
if windows?
|
611
611
|
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
|
612
|
-
elsif
|
612
|
+
elsif macos? || solaris? || freebsd? || aix?
|
613
613
|
expect { resource.run_action(:create) }.to raise_error(Errno::EPERM)
|
614
614
|
else
|
615
615
|
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
|
@@ -656,10 +656,10 @@ describe Chef::Resource::Link do
|
|
656
656
|
end
|
657
657
|
context "and the link does not yet exist" do
|
658
658
|
it "links to the target file" do
|
659
|
-
skip("
|
659
|
+
skip("macOS/FreeBSD/AIX/Solaris symlink? and readlink working on hard links to symlinks") if macos? || freebsd? || aix? || solaris?
|
660
660
|
resource.run_action(:create)
|
661
|
-
expect(File.
|
662
|
-
#
|
661
|
+
expect(File.exist?(target_file)).to be_truthy
|
662
|
+
# macOS gets angry about this sort of link. Bug in macOS, IMO.
|
663
663
|
expect(symlink?(target_file)).to be_truthy
|
664
664
|
expect(readlink(target_file)).to eq(canonicalize(@other_target))
|
665
665
|
end
|
@@ -675,9 +675,9 @@ describe Chef::Resource::Link do
|
|
675
675
|
end
|
676
676
|
context "and the link does not yet exist" do
|
677
677
|
it "links to the target file" do
|
678
|
-
skip("
|
678
|
+
skip("macOS/FreeBSD/AIX/Solaris fails to create hardlinks to broken symlinks") if macos? || freebsd? || aix? || solaris?
|
679
679
|
resource.run_action(:create)
|
680
|
-
expect(File.
|
680
|
+
expect(File.exist?(target_file) || File.symlink?(target_file)).to be_truthy
|
681
681
|
expect(symlink?(target_file)).to be_truthy
|
682
682
|
expect(readlink(target_file)).to eq(canonicalize(@other_target))
|
683
683
|
end
|
@@ -39,7 +39,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
|
|
39
39
|
# mytest rpm package works in centos, redhat and in suse without any dependency issues.
|
40
40
|
else
|
41
41
|
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(0)
|
42
|
-
::File.
|
42
|
+
::File.exist?("/opt/mytest/mytest.sh") # The mytest rpm package contains the mytest.sh file
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -48,7 +48,7 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
|
|
48
48
|
expect(shell_out("rpm -qa | grep dummy").exitstatus).to eq(1)
|
49
49
|
else
|
50
50
|
expect(shell_out("rpm -qa | grep mytest").exitstatus).to eq(1)
|
51
|
-
!::File.
|
51
|
+
!::File.exist?("/opt/mytest/mytest.sh")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -390,7 +390,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
390
390
|
end
|
391
391
|
|
392
392
|
after do
|
393
|
-
if File.
|
393
|
+
if File.exist?(out_path)
|
394
394
|
File.delete(out_path)
|
395
395
|
end
|
396
396
|
end
|
@@ -405,7 +405,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
405
405
|
expect(no_of_certificates).to eq(1)
|
406
406
|
end
|
407
407
|
it "Stores Certificate content at given path" do
|
408
|
-
expect(File.
|
408
|
+
expect(File.exist?(out_path)).to be_truthy
|
409
409
|
end
|
410
410
|
it "Does not converge while fetching" do
|
411
411
|
expect(win_certificate).not_to be_updated_by_last_action
|
@@ -425,7 +425,7 @@ describe Chef::Resource::WindowsCertificate, :windows_only do
|
|
425
425
|
expect(stdout.string.strip).to be_empty
|
426
426
|
end
|
427
427
|
it "Does not store certificate content at given path" do
|
428
|
-
expect(File.
|
428
|
+
expect(File.exist?(out_path)).to be_falsy
|
429
429
|
end
|
430
430
|
it "Does not converge while fetching" do
|
431
431
|
expect(win_certificate).not_to be_updated_by_last_action
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Dheeraj Singh Dubey (<ddubey@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "spec_helper"
|
20
|
+
|
21
|
+
describe Chef::Resource::WindowsFont, :windows_only do
|
22
|
+
let(:resource_name) { "Playmaker.ttf" }
|
23
|
+
let(:resource_source) { "https://www.wfonts.com/download/data/2020/05/06/playmaker/Playmaker.ttf" }
|
24
|
+
|
25
|
+
let(:run_context) do
|
26
|
+
node = Chef::Node.new
|
27
|
+
node.default[:platform] = ohai[:platform]
|
28
|
+
node.default[:platform_version] = ohai[:platform_version]
|
29
|
+
node.default[:os] = ohai[:os]
|
30
|
+
events = Chef::EventDispatch::Dispatcher.new
|
31
|
+
Chef::RunContext.new(node, {}, events)
|
32
|
+
end
|
33
|
+
|
34
|
+
subject do
|
35
|
+
resource = Chef::Resource::WindowsFont.new(resource_name, run_context)
|
36
|
+
resource.source resource_source
|
37
|
+
resource
|
38
|
+
end
|
39
|
+
|
40
|
+
it "installs font on first install" do
|
41
|
+
subject.run_action(:install)
|
42
|
+
expect(subject).to be_updated_by_last_action
|
43
|
+
end
|
44
|
+
|
45
|
+
it "does not install font when already installed" do
|
46
|
+
subject.run_action(:install)
|
47
|
+
expect(subject).not_to be_updated_by_last_action
|
48
|
+
end
|
49
|
+
end
|
@@ -125,7 +125,7 @@ describe "Chef::Application::WindowsServiceManager", :windows_only, :system_wind
|
|
125
125
|
it "start should start the service", :volatile do
|
126
126
|
service_manager.run(["-a", "start"])
|
127
127
|
expect(test_service_state).to eq("running")
|
128
|
-
expect(File.
|
128
|
+
expect(File.exist?(test_service_file)).to be_truthy
|
129
129
|
end
|
130
130
|
|
131
131
|
it "stop should not affect the service" do
|
@@ -59,7 +59,7 @@ describe "LWRPs with inline resources" do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
after { File.delete(LwrpShadowedPropertyTest::PATH) if File.
|
62
|
+
after { File.delete(LwrpShadowedPropertyTest::PATH) if File.exist?(LwrpShadowedPropertyTest::PATH) }
|
63
63
|
|
64
64
|
# https://github.com/chef/chef/issues/4334
|
65
65
|
it "does not warn spuriously" do
|
data/spec/spec_helper.rb
CHANGED
@@ -69,7 +69,7 @@ end
|
|
69
69
|
|
70
70
|
# If you want to load anything into the testing environment
|
71
71
|
# without versioning it, add it to spec/support/local_gems.rb
|
72
|
-
require "spec/support/local_gems.rb" if File.
|
72
|
+
require "spec/support/local_gems.rb" if File.exist?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
|
73
73
|
|
74
74
|
# Explicitly require spec helpers that need to load first
|
75
75
|
require "spec/support/platform_helpers"
|
@@ -139,9 +139,10 @@ RSpec.configure do |config|
|
|
139
139
|
|
140
140
|
config.filter_run_excluding windows_only: true unless windows?
|
141
141
|
config.filter_run_excluding not_supported_on_windows: true if windows?
|
142
|
-
config.filter_run_excluding not_supported_on_macos: true if
|
143
|
-
config.filter_run_excluding macos_only: true unless
|
144
|
-
config.filter_run_excluding
|
142
|
+
config.filter_run_excluding not_supported_on_macos: true if macos?
|
143
|
+
config.filter_run_excluding macos_only: true unless macos?
|
144
|
+
config.filter_run_excluding macos_1013: true unless macos_1013?
|
145
|
+
config.filter_run_excluding macos_gte_1014: true unless macos_gte_1014?
|
145
146
|
config.filter_run_excluding not_supported_on_aix: true if aix?
|
146
147
|
config.filter_run_excluding not_supported_on_solaris: true if solaris?
|
147
148
|
config.filter_run_excluding not_supported_on_gce: true if gce?
|