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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/lib/chef/api_client/registration.rb +2 -2
  4. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
  5. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  6. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
  7. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  8. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  9. data/lib/chef/environment.rb +2 -2
  10. data/lib/chef/http.rb +2 -1
  11. data/lib/chef/knife/bootstrap.rb +2 -2
  12. data/lib/chef/knife/cookbook_download.rb +1 -1
  13. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  14. data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
  15. data/lib/chef/knife/exec.rb +2 -2
  16. data/lib/chef/knife/ssh.rb +16 -1
  17. data/lib/chef/provider/service/arch.rb +2 -2
  18. data/lib/chef/provider/service/debian.rb +1 -1
  19. data/lib/chef/provider/service/gentoo.rb +2 -2
  20. data/lib/chef/provider/service/macosx.rb +2 -2
  21. data/lib/chef/provider/service/openbsd.rb +1 -1
  22. data/lib/chef/provider/service/redhat.rb +2 -2
  23. data/lib/chef/provider/service/upstart.rb +1 -1
  24. data/lib/chef/resource/hostname.rb +18 -18
  25. data/lib/chef/resource/sudo.rb +1 -1
  26. data/lib/chef/resource/windows_feature_powershell.rb +6 -2
  27. data/lib/chef/resource/windows_font.rb +2 -1
  28. data/lib/chef/role.rb +2 -2
  29. data/lib/chef/shell.rb +1 -1
  30. data/lib/chef/util/diff.rb +1 -1
  31. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  32. data/lib/chef/version.rb +1 -1
  33. data/lib/chef/win32/file.rb +2 -2
  34. data/spec/functional/resource/aixinit_service_spec.rb +7 -7
  35. data/spec/functional/resource/bff_spec.rb +2 -2
  36. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  37. data/spec/functional/resource/dsc_resource_spec.rb +1 -1
  38. data/spec/functional/resource/insserv_spec.rb +4 -4
  39. data/spec/functional/resource/link_spec.rb +17 -17
  40. data/spec/functional/resource/rpm_spec.rb +2 -2
  41. data/spec/functional/resource/user/dscl_spec.rb +1 -1
  42. data/spec/functional/resource/user/mac_user_spec.rb +1 -1
  43. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  44. data/spec/functional/resource/windows_font_spec.rb +49 -0
  45. data/spec/functional/win32/service_manager_spec.rb +1 -1
  46. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
  47. data/spec/spec_helper.rb +5 -4
  48. data/spec/support/platform_helpers.rb +12 -42
  49. data/spec/support/platforms/win32/spec_service.rb +1 -1
  50. data/spec/support/shared/functional/directory_resource.rb +1 -1
  51. data/spec/support/shared/functional/execute_resource.rb +1 -1
  52. data/spec/support/shared/functional/file_resource.rb +2 -2
  53. data/spec/support/shared/functional/win32_service.rb +1 -1
  54. data/spec/support/shared/functional/windows_script.rb +3 -3
  55. data/spec/unit/environment_spec.rb +7 -7
  56. data/spec/unit/knife/bootstrap_spec.rb +14 -14
  57. data/spec/unit/knife/cookbook_download_spec.rb +4 -4
  58. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
  59. data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
  60. data/spec/unit/knife/ssh_spec.rb +2 -2
  61. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  62. data/spec/unit/provider/service/arch_service_spec.rb +3 -2
  63. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  64. data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
  65. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  66. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  67. data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
  68. data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
  69. data/spec/unit/role_spec.rb +11 -11
  70. metadata +7 -6
@@ -3,7 +3,6 @@ require "chef/mixin/shell_out"
3
3
  require "ohai/mixin/http_helper"
4
4
  require "ohai/mixin/gce_metadata"
5
5
  require "chef/mixin/powershell_out"
6
- require "chef/version_class"
7
6
 
8
7
  class ShellHelpers
9
8
  extend Chef::Mixin::ShellOut
@@ -100,39 +99,12 @@ def windows_user_right?(right)
100
99
  Chef::ReservedNames::Win32::Security.get_account_right(ENV["USERNAME"]).include?(right)
101
100
  end
102
101
 
103
- def mac_osx_106?
104
- if File.exists? "/usr/bin/sw_vers"
105
- result = ShellHelpers.shell_out("/usr/bin/sw_vers")
106
- result.stdout.each_line do |line|
107
- if line =~ /^ProductVersion:\s10.6.*$/
108
- return true
109
- end
110
- end
111
- end
112
-
113
- false
114
- end
115
-
116
- def mac_osx_1014?
117
- if mac_osx?
118
- ver = Chef::Version.new(ohai[:platform_version])
119
- return ver.major == 10 && ver.minor == 14
120
- end
121
-
122
- false
102
+ def macos_1013?
103
+ macos? && Gem::Requirement.new("~> 10.13.0").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
123
104
  end
124
105
 
125
- def mac_osx?
126
- if File.exists? "/usr/bin/sw_vers"
127
- result = ShellHelpers.shell_out("/usr/bin/sw_vers")
128
- result.stdout.each_line do |line|
129
- if line =~ /^ProductName:\sMac OS X.*$/
130
- return true
131
- end
132
- end
133
- end
134
-
135
- false
106
+ def macos_gte_1014?
107
+ macos? && Gem::Requirement.new(">= 10.14").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
136
108
  end
137
109
 
138
110
  # detects if the hardware is 64-bit (evaluates to true in "WOW64" mode in a 32-bit app on a 64-bit system)
@@ -145,26 +117,24 @@ def windows32?
145
117
  windows? && !windows64?
146
118
  end
147
119
 
148
- # def jruby?
149
-
150
120
  def unix?
151
121
  !windows?
152
122
  end
153
123
 
154
124
  def linux?
155
- !!(RUBY_PLATFORM =~ /linux/)
125
+ RUBY_PLATFORM.match?(/linux/)
156
126
  end
157
127
 
158
- def os_x?
159
- !!(RUBY_PLATFORM =~ /darwin/)
128
+ def macos?
129
+ RUBY_PLATFORM.match?(/darwin/)
160
130
  end
161
131
 
162
132
  def solaris?
163
- !!(RUBY_PLATFORM =~ /solaris/)
133
+ RUBY_PLATFORM.match?(/solaris/)
164
134
  end
165
135
 
166
136
  def freebsd?
167
- !!(RUBY_PLATFORM =~ /freebsd/)
137
+ RUBY_PLATFORM.match?(/freebsd/)
168
138
  end
169
139
 
170
140
  def intel_64bit?
@@ -200,7 +170,7 @@ def debian_family?
200
170
  end
201
171
 
202
172
  def aix?
203
- !!(RUBY_PLATFORM =~ /aix/)
173
+ RUBY_PLATFORM.match?(/aix/)
204
174
  end
205
175
 
206
176
  def wpar?
@@ -236,8 +206,8 @@ def selinux_enabled?
236
206
  end
237
207
 
238
208
  def suse?
239
- ::File.exists?("/etc/SuSE-release") ||
240
- ( ::File.exists?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
209
+ ::File.exist?("/etc/SuSE-release") ||
210
+ ( ::File.exist?("/etc/os-release") && /sles|suse/.match?(File.read("/etc/os-release")) )
241
211
  end
242
212
 
243
213
  def root?
@@ -26,7 +26,7 @@ if RUBY_PLATFORM =~ /mswin|mingw|windows/
26
26
 
27
27
  def service_main(*startup_parameters)
28
28
  while running?
29
- unless File.exists?(@test_service_file)
29
+ unless File.exist?(@test_service_file)
30
30
  File.open(@test_service_file, "wb") do |f|
31
31
  f.write("This file is created by SpecService")
32
32
  end
@@ -173,6 +173,6 @@ shared_context Chef::Resource::Directory do
173
173
  end
174
174
 
175
175
  after(:each) do
176
- FileUtils.rm_r(path) if File.exists?(path)
176
+ FileUtils.rm_r(path) if File.exist?(path)
177
177
  end
178
178
  end
@@ -62,7 +62,7 @@ shared_context "a command that can be executed as an alternate user" do
62
62
  end
63
63
 
64
64
  after do
65
- File.delete(script_output_path) if File.exists?(script_output_path)
65
+ File.delete(script_output_path) if File.exist?(script_output_path)
66
66
  Dir.rmdir(script_output_dir) if Dir.exist?(script_output_dir)
67
67
  end
68
68
  end
@@ -1038,8 +1038,8 @@ shared_context Chef::Resource::File do
1038
1038
  end
1039
1039
 
1040
1040
  after(:each) do
1041
- FileUtils.rm_r(path) if File.exists?(path)
1042
- FileUtils.rm_r(CHEF_SPEC_BACKUP_PATH) if File.exists?(CHEF_SPEC_BACKUP_PATH)
1041
+ FileUtils.rm_r(path) if File.exist?(path)
1042
+ FileUtils.rm_r(CHEF_SPEC_BACKUP_PATH) if File.exist?(CHEF_SPEC_BACKUP_PATH)
1043
1043
  end
1044
1044
 
1045
1045
  after do
@@ -30,7 +30,7 @@ shared_context "using Win32::Service" do
30
30
  end
31
31
 
32
32
  # Delete the test_service_file if it exists
33
- if File.exists?(test_service_file)
33
+ if File.exist?(test_service_file)
34
34
  File.delete(test_service_file)
35
35
  end
36
36
  end
@@ -39,11 +39,11 @@ shared_context Chef::Resource::WindowsScript do
39
39
  end
40
40
 
41
41
  before(:each) do
42
- File.delete(script_output_path) if File.exists?(script_output_path)
42
+ File.delete(script_output_path) if File.exist?(script_output_path)
43
43
  end
44
44
 
45
45
  after(:each) do
46
- File.delete(script_output_path) if File.exists?(script_output_path)
46
+ File.delete(script_output_path) if File.exist?(script_output_path)
47
47
  end
48
48
 
49
49
  shared_examples_for "a script resource with architecture attribute" do
@@ -149,7 +149,7 @@ shared_context Chef::Resource::WindowsScript do
149
149
 
150
150
  after do
151
151
  script_file.close! if script_file
152
- ::File.delete(script_file.to_path) if script_file && ::File.exists?(script_file.to_path)
152
+ ::File.delete(script_file.to_path) if script_file && ::File.exist?(script_file.to_path)
153
153
  end
154
154
 
155
155
  include_context "alternate user identity"
@@ -402,8 +402,8 @@ describe Chef::Environment do
402
402
 
403
403
  it "should get the environment from the environment_path" do
404
404
  expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
405
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
406
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
405
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
406
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
407
407
  expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
408
408
  expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
409
409
  role_dsl = "name \"foo\"\ndescription \"desc\"\n"
@@ -413,7 +413,7 @@ describe Chef::Environment do
413
413
 
414
414
  it "should return a Chef::Environment object from JSON" do
415
415
  expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
416
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
416
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
417
417
  environment_hash = {
418
418
  "name" => "foo",
419
419
  "default_attributes" => {
@@ -436,8 +436,8 @@ describe Chef::Environment do
436
436
 
437
437
  it "should return a Chef::Environment object from Ruby DSL" do
438
438
  expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
439
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
440
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
439
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
440
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
441
441
  expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
442
442
  expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
443
443
  role_dsl = "name \"foo\"\ndescription \"desc\"\n"
@@ -459,8 +459,8 @@ describe Chef::Environment do
459
459
 
460
460
  it "should raise an error if the file does not exist" do
461
461
  expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
462
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
463
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
462
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
463
+ expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
464
464
 
465
465
  expect do
466
466
  Chef::Environment.load("foo")
@@ -206,7 +206,7 @@ describe Chef::Knife::Bootstrap do
206
206
  end
207
207
 
208
208
  before(:each) do
209
- expect(File).to receive(:exists?).with(bootstrap_template).and_return(false)
209
+ expect(File).to receive(:exist?).with(bootstrap_template).and_return(false)
210
210
  end
211
211
 
212
212
  context "when file is available everywhere" do
@@ -215,7 +215,7 @@ describe Chef::Knife::Bootstrap do
215
215
  configure_env_home
216
216
  configure_gem_files
217
217
 
218
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(true)
218
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(true)
219
219
  end
220
220
 
221
221
  it "should load the template from built-in templates" do
@@ -229,8 +229,8 @@ describe Chef::Knife::Bootstrap do
229
229
  configure_env_home
230
230
  configure_gem_files
231
231
 
232
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
233
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(true)
232
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
233
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(true)
234
234
 
235
235
  it "should load the template from chef_config_dir" do
236
236
  knife.find_template.should eq(chef_config_dir_template_path)
@@ -244,9 +244,9 @@ describe Chef::Knife::Bootstrap do
244
244
  configure_env_home
245
245
  configure_gem_files
246
246
 
247
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
248
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
249
- expect(File).to receive(:exists?).with(env_home_template_path).and_return(true)
247
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
248
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
249
+ expect(File).to receive(:exist?).with(env_home_template_path).and_return(true)
250
250
  end
251
251
 
252
252
  it "should load the template from chef_config_dir" do
@@ -260,10 +260,10 @@ describe Chef::Knife::Bootstrap do
260
260
  configure_env_home
261
261
  configure_gem_files
262
262
 
263
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
264
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
265
- expect(File).to receive(:exists?).with(env_home_template_path).and_return(false)
266
- expect(File).to receive(:exists?).with(gem_files_template_path).and_return(true)
263
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
264
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
265
+ expect(File).to receive(:exist?).with(env_home_template_path).and_return(false)
266
+ expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
267
267
  end
268
268
 
269
269
  it "should load the template from Gem files" do
@@ -277,9 +277,9 @@ describe Chef::Knife::Bootstrap do
277
277
  configure_gem_files
278
278
  allow(Chef::Util::PathHelper).to receive(:home).with(".chef", "bootstrap", "example.erb").and_return(nil)
279
279
 
280
- expect(File).to receive(:exists?).with(builtin_template_path).and_return(false)
281
- expect(File).to receive(:exists?).with(chef_config_dir_template_path).and_return(false)
282
- expect(File).to receive(:exists?).with(gem_files_template_path).and_return(true)
280
+ expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
281
+ expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
282
+ expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
283
283
  end
284
284
 
285
285
  it "should load the template from Gem files" do
@@ -94,7 +94,7 @@ describe Chef::Knife::CookbookDownload do
94
94
  let (:manifest_data) { { all_files: [] } }
95
95
  it "should determine which version to download" do
96
96
  expect(@knife).to receive(:determine_version).and_return("1.0.0")
97
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
97
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
98
98
  @knife.run
99
99
  end
100
100
  end
@@ -111,7 +111,7 @@ describe Chef::Knife::CookbookDownload do
111
111
  end
112
112
 
113
113
  it "should print an error and exit if the cookbook download directory already exists" do
114
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
114
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
115
115
  expect(@knife.ui).to receive(:fatal).with(%r{/var/tmp/chef/foobar-1\.0\.0 exists}i)
116
116
  expect { @knife.run }.to raise_error(SystemExit)
117
117
  end
@@ -135,7 +135,7 @@ describe Chef::Knife::CookbookDownload do
135
135
  end
136
136
 
137
137
  it "should download the cookbook when the cookbook download directory doesn't exist" do
138
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
138
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
139
139
  @knife.run
140
140
  %w{attributes recipes templates}.each do |segment|
141
141
  expect(@stderr.string).to match /downloading #{segment}/im
@@ -147,7 +147,7 @@ describe Chef::Knife::CookbookDownload do
147
147
  describe "with -f or --force" do
148
148
  it "should remove the existing the cookbook download directory if it exists" do
149
149
  @knife.config[:force] = true
150
- expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
150
+ expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
151
151
  expect(FileUtils).to receive(:rm_rf).with("/var/tmp/chef/foobar-1.0.0")
152
152
  @knife.run
153
153
  end
@@ -34,7 +34,7 @@ describe Chef::Knife::CookbookMetadataFromFile do
34
34
  end
35
35
 
36
36
  after do
37
- if File.exists?(@tgt)
37
+ if File.exist?(@tgt)
38
38
  File.unlink(@tgt)
39
39
  end
40
40
  end
@@ -50,7 +50,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
50
50
 
51
51
  describe "#list_commands" do
52
52
  before do
53
- allow(File).to receive(:exists?).and_return(true)
53
+ allow(File).to receive(:exist?).and_return(true)
54
54
  end
55
55
 
56
56
  it "lists all commands by category when no argument is given" do
@@ -63,7 +63,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
63
63
 
64
64
  context "when the plugin path is invalid" do
65
65
  before do
66
- expect(File).to receive(:exists?).with("/file/for/plugin/b").and_return(false)
66
+ expect(File).to receive(:exist?).with("/file/for/plugin/b").and_return(false)
67
67
  end
68
68
 
69
69
  it "lists all commands by category when no argument is given" do
@@ -90,7 +90,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
90
90
  end
91
91
 
92
92
  it "loads the correct file and returns true if the command exists" do
93
- allow(File).to receive(:exists?).and_return(true)
93
+ allow(File).to receive(:exist?).and_return(true)
94
94
  expect(Kernel).to receive(:load).with("/file/for/plugin/a").and_return(true)
95
95
  expect(loader.load_command(["cool_a"])).to eq(true)
96
96
  end
@@ -279,10 +279,10 @@ describe Chef::Knife::Ssh do
279
279
  end
280
280
 
281
281
  describe "#ssh_command" do
282
- let(:execution_channel) { double(:execution_channel, on_data: nil) }
282
+ let(:execution_channel) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
283
283
  let(:session_channel) { double(:session_channel, request_pty: nil) }
284
284
 
285
- let(:execution_channel2) { double(:execution_channel, on_data: nil) }
285
+ let(:execution_channel2) { double(:execution_channel, on_data: nil, on_extended_data: nil) }
286
286
  let(:session_channel2) { double(:session_channel, request_pty: nil) }
287
287
 
288
288
  let(:session) { double(:session, loop: nil) }
@@ -108,7 +108,7 @@ describe Chef::Knife::SupermarketShare do
108
108
  expect { @knife.run }.to raise_error(SystemExit)
109
109
  end
110
110
 
111
- if File.exists?("/usr/bin/gnutar") || File.exists?("/bin/gnutar")
111
+ if File.exist?("/usr/bin/gnutar") || File.exist?("/bin/gnutar")
112
112
  it "should use gnutar to make a tarball of the cookbook" do
113
113
  expect(@knife).to receive(:shell_out!) do |args|
114
114
  expect(args.to_s).to match(/gnutar -czf/)
@@ -37,7 +37,8 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
37
37
 
38
38
  @provider = Chef::Provider::Service::Arch.new(@new_resource, @run_context)
39
39
 
40
- allow(::File).to receive(:exists?).with("/etc/rc.conf").and_return(true)
40
+ allow(::File).to receive(:exist?).with("/etc/rc.d/chef").and_return(false)
41
+ allow(::File).to receive(:exist?).with("/etc/rc.conf").and_return(true)
41
42
  allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network apache sshd)")
42
43
  end
43
44
 
@@ -106,7 +107,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
106
107
  end
107
108
 
108
109
  it "should fail if file /etc/rc.conf does not exist" do
109
- allow(::File).to receive(:exists?).with("/etc/rc.conf").and_return(false)
110
+ allow(::File).to receive(:exist?).with("/etc/rc.conf").and_return(false)
110
111
  expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Service)
111
112
  end
112
113
 
@@ -47,7 +47,7 @@ describe Chef::Provider::Service::Debian do
47
47
 
48
48
  describe "load_current_resource" do
49
49
  it "ensures /usr/sbin/update-rc.d is available" do
50
- expect(File).to receive(:exists?).with("/usr/sbin/update-rc.d") .and_return(false)
50
+ expect(File).to receive(:exist?).with("/usr/sbin/update-rc.d").and_return(false)
51
51
 
52
52
  @provider.define_resource_requirements
53
53
  expect do
@@ -32,16 +32,16 @@ describe Chef::Provider::Service::Gentoo do
32
32
  allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
33
33
  @status = double("Status", exitstatus: 0, stdout: @stdout)
34
34
  allow(@provider).to receive(:shell_out).and_return(@status)
35
- allow(File).to receive(:exists?).with("/etc/init.d/chef").and_return(true)
36
- allow(File).to receive(:exists?).with("/sbin/rc-update").and_return(true)
37
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
35
+ allow(File).to receive(:exist?).with("/etc/init.d/chef").and_return(true)
36
+ allow(File).to receive(:exist?).with("/sbin/rc-update").and_return(true)
37
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(false)
38
38
  allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
39
39
  end
40
40
  # new test: found_enabled state
41
41
  #
42
42
  describe "load_current_resource" do
43
43
  it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do
44
- expect(File).to receive(:exists?).with("/sbin/rc-update").and_return(false)
44
+ expect(File).to receive(:exist?).with("/sbin/rc-update").and_return(false)
45
45
  @provider.define_resource_requirements
46
46
  expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
47
47
  end
@@ -65,7 +65,7 @@ describe Chef::Provider::Service::Gentoo do
65
65
 
66
66
  describe "and the file exists and is readable" do
67
67
  before do
68
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(true)
68
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(true)
69
69
  allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(true)
70
70
  end
71
71
  it "should set enabled to true" do
@@ -76,7 +76,7 @@ describe Chef::Provider::Service::Gentoo do
76
76
 
77
77
  describe "and the file exists but is not readable" do
78
78
  before do
79
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(true)
79
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(true)
80
80
  allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
81
81
  end
82
82
 
@@ -88,7 +88,7 @@ describe Chef::Provider::Service::Gentoo do
88
88
 
89
89
  describe "and the file does not exist" do
90
90
  before do
91
- allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
91
+ allow(File).to receive(:exist?).with("/etc/runlevels/default/chef").and_return(false)
92
92
  allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return("foobarbaz")
93
93
  end
94
94