chef 14.1.12-universal-mingw32 → 14.2.0-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -6
  3. data/VERSION +1 -1
  4. data/chef.gemspec +2 -3
  5. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
  6. data/lib/chef/cookbook/manifest_v0.rb +2 -2
  7. data/lib/chef/cookbook_manifest.rb +3 -2
  8. data/lib/chef/cookbook_version.rb +3 -2
  9. data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
  10. data/lib/chef/http/auth_credentials.rb +5 -3
  11. data/lib/chef/http/authenticator.rb +6 -3
  12. data/lib/chef/knife.rb +3 -6
  13. data/lib/chef/knife/configure.rb +12 -8
  14. data/lib/chef/knife/raw.rb +6 -1
  15. data/lib/chef/mixin/shell_out.rb +16 -14
  16. data/lib/chef/provider/execute.rb +4 -3
  17. data/lib/chef/provider/git.rb +1 -1
  18. data/lib/chef/provider/package/dnf.rb +5 -5
  19. data/lib/chef/provider/package/windows.rb +7 -0
  20. data/lib/chef/provider/package/yum.rb +7 -7
  21. data/lib/chef/provider/service/freebsd.rb +3 -3
  22. data/lib/chef/provider/service/init.rb +5 -5
  23. data/lib/chef/provider/service/macosx.rb +5 -4
  24. data/lib/chef/provider/service/simple.rb +4 -4
  25. data/lib/chef/provider/service/systemd.rb +13 -13
  26. data/lib/chef/provider/service/upstart.rb +3 -3
  27. data/lib/chef/provider/service/windows.rb +2 -0
  28. data/lib/chef/provider/systemd_unit.rb +4 -4
  29. data/lib/chef/provider/user.rb +18 -1
  30. data/lib/chef/provider/user/aix.rb +40 -8
  31. data/lib/chef/provider/user/dscl.rb +7 -14
  32. data/lib/chef/provider/user/linux.rb +1 -11
  33. data/lib/chef/provider/user/solaris.rb +57 -26
  34. data/lib/chef/provider/user/useradd.rb +4 -1
  35. data/lib/chef/provider/windows_task.rb +1 -0
  36. data/lib/chef/providers.rb +1 -2
  37. data/lib/chef/resource/execute.rb +4 -1
  38. data/lib/chef/resource/gem_package.rb +1 -1
  39. data/lib/chef/resource/hostname.rb +1 -1
  40. data/lib/chef/resource/sysctl.rb +3 -1
  41. data/lib/chef/resource/windows_ad_join.rb +16 -3
  42. data/lib/chef/resource_inspector.rb +13 -0
  43. data/lib/chef/run_context/cookbook_compiler.rb +1 -1
  44. data/lib/chef/server_api.rb +2 -0
  45. data/lib/chef/version.rb +1 -1
  46. data/spec/functional/mixin/shell_out_spec.rb +27 -1
  47. data/spec/functional/resource/execute_spec.rb +2 -2
  48. data/spec/functional/resource/windows_task_spec.rb +1 -1
  49. data/spec/support/shared/functional/securable_resource.rb +1 -1
  50. data/spec/support/shared/unit/execute_resource.rb +1 -1
  51. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
  52. data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
  53. data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
  54. data/spec/unit/cookbook_manifest_spec.rb +2 -0
  55. data/spec/unit/dsl/recipe_spec.rb +1 -5
  56. data/spec/unit/http/authenticator_spec.rb +33 -8
  57. data/spec/unit/mixin/shell_out_spec.rb +61 -1
  58. data/spec/unit/provider/apt_update_spec.rb +7 -7
  59. data/spec/unit/provider/execute_spec.rb +16 -15
  60. data/spec/unit/provider/git_spec.rb +3 -3
  61. data/spec/unit/provider/package/windows_spec.rb +12 -0
  62. data/spec/unit/provider/script_spec.rb +2 -2
  63. data/spec/unit/provider/service/arch_service_spec.rb +9 -9
  64. data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
  65. data/spec/unit/provider/service/init_service_spec.rb +11 -11
  66. data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
  67. data/spec/unit/provider/service/macosx_spec.rb +11 -11
  68. data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
  69. data/spec/unit/provider/service/simple_service_spec.rb +4 -4
  70. data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
  71. data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
  72. data/spec/unit/provider/service/windows_spec.rb +5 -0
  73. data/spec/unit/provider/systemd_unit_spec.rb +163 -118
  74. data/spec/unit/provider/user/dscl_spec.rb +2 -9
  75. data/spec/unit/provider/user/solaris_spec.rb +2 -2
  76. data/spec/unit/provider/zypper_repository_spec.rb +3 -3
  77. data/spec/unit/provider_spec.rb +1 -5
  78. data/spec/unit/resource/apt_package_spec.rb +14 -0
  79. data/spec/unit/resource/apt_preference_spec.rb +14 -1
  80. data/spec/unit/resource/apt_repository_spec.rb +12 -3
  81. data/spec/unit/resource/apt_update_spec.rb +9 -0
  82. data/spec/unit/resource/bash_spec.rb +8 -0
  83. data/spec/unit/resource/bff_package_spec.rb +51 -0
  84. data/spec/unit/resource/breakpoint_spec.rb +4 -4
  85. data/spec/unit/resource/build_essential_spec.rb +5 -1
  86. data/spec/unit/resource/cab_package_spec.rb +10 -0
  87. data/spec/unit/resource/chef_gem_spec.rb +14 -0
  88. data/spec/unit/resource/chef_handler_spec.rb +9 -4
  89. data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
  90. data/spec/unit/resource/conditional_spec.rb +3 -3
  91. data/spec/unit/resource/cookbook_file_spec.rb +13 -2
  92. data/spec/unit/resource/cron_spec.rb +2 -7
  93. data/spec/unit/resource/csh_spec.rb +8 -0
  94. data/spec/unit/resource/directory_spec.rb +4 -9
  95. data/spec/unit/resource/dmg_package_spec.rb +8 -4
  96. data/spec/unit/resource/dnf_package_spec.rb +16 -1
  97. data/spec/unit/resource/dpkg_package_spec.rb +18 -0
  98. data/spec/unit/resource/dsc_resource_spec.rb +6 -6
  99. data/spec/unit/resource/dsc_script_spec.rb +39 -39
  100. data/spec/unit/resource/execute_spec.rb +20 -12
  101. data/spec/unit/resource/file_spec.rb +10 -10
  102. data/spec/unit/resource/freebsd_package_spec.rb +16 -0
  103. data/spec/unit/resource/gem_package_spec.rb +27 -0
  104. data/spec/unit/resource/git_spec.rb +17 -2
  105. data/spec/unit/resource/group_spec.rb +18 -17
  106. data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
  107. data/spec/unit/resource/homebrew_package_spec.rb +14 -0
  108. data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
  109. data/spec/unit/resource/hostname_spec.rb +10 -6
  110. data/spec/unit/resource/http_request_spec.rb +14 -0
  111. data/spec/unit/resource/ips_package_spec.rb +15 -3
  112. data/spec/unit/resource/ksh_spec.rb +8 -0
  113. data/spec/unit/resource/launchd_spec.rb +11 -5
  114. data/spec/unit/resource/link_spec.rb +6 -11
  115. data/spec/unit/resource/log_spec.rb +8 -8
  116. data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
  117. data/spec/unit/resource/macports_package_spec.rb +19 -0
  118. data/spec/unit/resource/mdadm_spec.rb +7 -3
  119. data/spec/unit/resource/mount_spec.rb +15 -18
  120. data/spec/unit/resource/msu_package_spec.rb +10 -0
  121. data/spec/unit/resource/ohai_hint_spec.rb +9 -8
  122. data/spec/unit/resource/ohai_spec.rb +11 -3
  123. data/spec/unit/resource/openbsd_package_spec.rb +14 -0
  124. data/spec/unit/resource/openssl_dhparam.rb +10 -5
  125. data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
  126. data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
  127. data/spec/unit/resource/osx_profile_spec.rb +7 -4
  128. data/spec/unit/resource/package_spec.rb +14 -0
  129. data/spec/unit/resource/pacman_package_spec.rb +17 -3
  130. data/spec/unit/resource/paludis_package_spec.rb +36 -0
  131. data/spec/unit/resource/perl_spec.rb +8 -0
  132. data/spec/unit/resource/portage_package_spec.rb +14 -0
  133. data/spec/unit/resource/powershell_package_spec.rb +14 -0
  134. data/spec/unit/resource/python_spec.rb +8 -0
  135. data/spec/unit/resource/reboot_spec.rb +5 -3
  136. data/spec/unit/resource/registry_key_spec.rb +12 -1
  137. data/spec/unit/resource/remote_directory_spec.rb +11 -1
  138. data/spec/unit/resource/remote_file_spec.rb +19 -0
  139. data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
  140. data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
  141. data/spec/unit/resource/rhsm_register_spec.rb +6 -1
  142. data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
  143. data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
  144. data/spec/unit/resource/route_spec.rb +4 -9
  145. data/spec/unit/resource/rpm_package_spec.rb +14 -0
  146. data/spec/unit/resource/ruby_block_spec.rb +12 -8
  147. data/spec/unit/resource/ruby_spec.rb +8 -0
  148. data/spec/unit/resource/scm_spec.rb +16 -8
  149. data/spec/unit/resource/script_spec.rb +8 -0
  150. data/spec/unit/resource/service_spec.rb +15 -0
  151. data/spec/unit/resource/smartos_package_spec.rb +18 -4
  152. data/spec/unit/resource/solaris_package_spec.rb +14 -0
  153. data/spec/unit/resource/subversion_spec.rb +14 -8
  154. data/spec/unit/resource/sudo_spec.rb +11 -4
  155. data/spec/unit/resource/swap_file_spec.rb +4 -5
  156. data/spec/unit/resource/sysctl_spec.rb +8 -10
  157. data/spec/unit/resource/systemd_unit_spec.rb +14 -12
  158. data/spec/unit/resource/template_spec.rb +19 -0
  159. data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
  160. data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
  161. data/spec/unit/resource/windows_env_spec.rb +8 -16
  162. data/spec/unit/resource/windows_feature.rb +27 -8
  163. data/spec/unit/resource/windows_feature_dism.rb +30 -9
  164. data/spec/unit/resource/windows_feature_powershell.rb +7 -7
  165. data/spec/unit/resource/windows_font_spec.rb +3 -4
  166. data/spec/unit/resource/windows_package_spec.rb +12 -2
  167. data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
  168. data/spec/unit/resource/windows_path_spec.rb +4 -5
  169. data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
  170. data/spec/unit/resource/windows_printer_spec.rb +12 -5
  171. data/spec/unit/resource/windows_service_spec.rb +24 -1
  172. data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
  173. data/spec/unit/resource/yum_repository_spec.rb +48 -2
  174. data/spec/unit/resource/zypper_package_spec.rb +51 -0
  175. data/spec/unit/resource/zypper_repository_spec.rb +56 -11
  176. data/spec/unit/resource_spec.rb +1 -5
  177. metadata +21 -12
  178. data/spec/functional/resource/user/useradd_spec.rb +0 -709
@@ -550,7 +550,7 @@ SHAS
550
550
  :cwd => "/my/deploy/dir",
551
551
  :log_tag => "git[web2.0 app]",
552
552
  :returns => [0, 1, 2]).and_return(command_response)
553
- expected_command = "git config --replace-all remote.#{@resource.remote}.url #{@resource.repository}"
553
+ expected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
554
554
  expect(@provider).to receive(:shell_out!).with(expected_command,
555
555
  :cwd => "/my/deploy/dir",
556
556
  :log_tag => "git[web2.0 app]")
@@ -566,7 +566,7 @@ SHAS
566
566
  :cwd => "/my/deploy/dir",
567
567
  :log_tag => "git[web2.0 app]",
568
568
  :returns => [0, 1, 2]).and_return(command_response)
569
- unexpected_command = "git config --replace-all remote.#{@resource.remote}.url #{@resource.repository}"
569
+ unexpected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
570
570
  expect(@provider).not_to receive(:shell_out!).with(unexpected_command,
571
571
  :cwd => "/my/deploy/dir",
572
572
  :log_tag => "git[web2.0 app]")
@@ -581,7 +581,7 @@ SHAS
581
581
  :cwd => "/my/deploy/dir",
582
582
  :log_tag => "git[web2.0 app]",
583
583
  :returns => [0, 1, 2]).and_return(command_response)
584
- expected_command = "git config --replace-all remote.#{@resource.remote}.url #{@resource.repository}"
584
+ expected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
585
585
  expect(@provider).to receive(:shell_out!).with(expected_command,
586
586
  :cwd => "/my/deploy/dir",
587
587
  :log_tag => "git[web2.0 app]")
@@ -394,6 +394,18 @@ describe Chef::Provider::Package::Windows, :windows_only do
394
394
  end
395
395
  end
396
396
  end
397
+
398
+ context "a missing local file is given" do
399
+ let(:resource_source) { "C:/a_missing_file.exe" }
400
+ let(:installer_type) { nil }
401
+
402
+ it "raises a Package error" do
403
+ allow(::File).to receive(:exist?).with(provider.new_resource.source).and_return(false)
404
+
405
+ provider.load_current_resource
406
+ expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
407
+ end
408
+ end
397
409
  end
398
410
 
399
411
  shared_context "valid checksum" do
@@ -131,7 +131,7 @@ describe Chef::Provider::Script, "action_run" do
131
131
 
132
132
  describe "when running the script" do
133
133
  let (:default_opts) do
134
- { timeout: 3600, returns: 0, log_level: :info, log_tag: "script[run some perl code]" }
134
+ { timeout: 3600, returns: 0, default_env: false, log_level: :info, log_tag: "script[run some perl code]" }
135
135
  end
136
136
 
137
137
  before do
@@ -143,7 +143,7 @@ describe Chef::Provider::Script, "action_run" do
143
143
  end
144
144
 
145
145
  it "should call shell_out! with the command" do
146
- expect(provider).to receive(:shell_out_with_systems_locale!).with(provider.command, default_opts).and_return(true)
146
+ expect(provider).to receive(:shell_out!).with(provider.command, default_opts).and_return(true)
147
147
  provider.action_run
148
148
  end
149
149
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Jan Zimmek (<jan.zimmek@web.de>)
3
3
  # Author:: AJ Christensen (<aj@hjksolutions.com>)
4
- # Copyright:: Copyright 2008-2016, Chef Software Inc.
4
+ # Copyright:: Copyright 2008-2018, Chef Software Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -222,12 +222,12 @@ RUNNING_PS
222
222
 
223
223
  it "should call the start command if one is specified" do
224
224
  @new_resource.start_command("/etc/rc.d/chef startyousillysally")
225
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef startyousillysally")
225
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/chef startyousillysally", default_env: false)
226
226
  @provider.start_service()
227
227
  end
228
228
 
229
229
  it "should call '/etc/rc.d/service_name start' if no start command is specified" do
230
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} start")
230
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} start", default_env: false)
231
231
  @provider.start_service()
232
232
  end
233
233
  end
@@ -248,12 +248,12 @@ RUNNING_PS
248
248
 
249
249
  it "should call the stop command if one is specified" do
250
250
  @new_resource.stop_command("/etc/rc.d/chef itoldyoutostop")
251
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef itoldyoutostop")
251
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/chef itoldyoutostop", default_env: false)
252
252
  @provider.stop_service()
253
253
  end
254
254
 
255
255
  it "should call '/etc/rc.d/service_name stop' if no stop command is specified" do
256
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} stop")
256
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} stop", default_env: false)
257
257
  @provider.stop_service()
258
258
  end
259
259
  end
@@ -275,13 +275,13 @@ RUNNING_PS
275
275
 
276
276
  it "should call 'restart' on the service_name if the resource supports it" do
277
277
  @new_resource.supports({ :restart => true })
278
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restart")
278
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restart", default_env: false)
279
279
  @provider.restart_service()
280
280
  end
281
281
 
282
282
  it "should call the restart_command if one has been specified" do
283
283
  @new_resource.restart_command("/etc/rc.d/chef restartinafire")
284
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire")
284
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire", default_env: false)
285
285
  @provider.restart_service()
286
286
  end
287
287
 
@@ -310,13 +310,13 @@ RUNNING_PS
310
310
 
311
311
  it "should call 'reload' on the service if it supports it" do
312
312
  @new_resource.supports({ :reload => true })
313
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} reload")
313
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} reload", default_env: false)
314
314
  @provider.reload_service()
315
315
  end
316
316
 
317
317
  it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
318
318
  @new_resource.reload_command("/etc/rc.d/chef lollerpants")
319
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants")
319
+ expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants", default_env: false)
320
320
  @provider.reload_service()
321
321
  end
322
322
  end
@@ -444,12 +444,12 @@ EOF
444
444
  describe Chef::Provider::Service::Freebsd, "start_service" do
445
445
  it "should call the start command if one is specified" do
446
446
  new_resource.start_command("/etc/rc.d/chef startyousillysally")
447
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef startyousillysally")
447
+ expect(provider).to receive(:shell_out!).with("/etc/rc.d/chef startyousillysally", default_env: false)
448
448
  provider.start_service()
449
449
  end
450
450
 
451
451
  it "should call '/usr/local/etc/rc.d/service_name faststart' if no start command is specified" do
452
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/usr/local/etc/rc.d/#{new_resource.service_name} faststart")
452
+ expect(provider).to receive(:shell_out!).with("/usr/local/etc/rc.d/#{new_resource.service_name} faststart", default_env: false)
453
453
  provider.start_service()
454
454
  end
455
455
  end
@@ -457,12 +457,12 @@ EOF
457
457
  describe Chef::Provider::Service::Freebsd, "stop_service" do
458
458
  it "should call the stop command if one is specified" do
459
459
  new_resource.stop_command("/etc/init.d/chef itoldyoutostop")
460
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef itoldyoutostop")
460
+ expect(provider).to receive(:shell_out!).with("/etc/init.d/chef itoldyoutostop", default_env: false)
461
461
  provider.stop_service()
462
462
  end
463
463
 
464
464
  it "should call '/usr/local/etc/rc.d/service_name faststop' if no stop command is specified" do
465
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/usr/local/etc/rc.d/#{new_resource.service_name} faststop")
465
+ expect(provider).to receive(:shell_out!).with("/usr/local/etc/rc.d/#{new_resource.service_name} faststop", default_env: false)
466
466
  provider.stop_service()
467
467
  end
468
468
  end
@@ -470,13 +470,13 @@ EOF
470
470
  describe Chef::Provider::Service::Freebsd, "restart_service" do
471
471
  it "should call 'restart' on the service_name if the resource supports it" do
472
472
  new_resource.supports({ :restart => true })
473
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/usr/local/etc/rc.d/#{new_resource.service_name} fastrestart")
473
+ expect(provider).to receive(:shell_out!).with("/usr/local/etc/rc.d/#{new_resource.service_name} fastrestart", default_env: false)
474
474
  provider.restart_service()
475
475
  end
476
476
 
477
477
  it "should call the restart_command if one has been specified" do
478
478
  new_resource.restart_command("/etc/init.d/chef restartinafire")
479
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef restartinafire")
479
+ expect(provider).to receive(:shell_out!).with("/etc/init.d/chef restartinafire", default_env: false)
480
480
  provider.restart_service()
481
481
  end
482
482
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@hjksolutions.com>)
3
- # Copyright:: Copyright 2008-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2018, 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");
@@ -100,7 +100,7 @@ PS
100
100
  end
101
101
 
102
102
  it "should use the init_command if one has been specified" do
103
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/opt/chef-server/service/erchef start")
103
+ expect(@provider).to receive(:shell_out!).with("/opt/chef-server/service/erchef start", default_env: false)
104
104
  @provider.start_service
105
105
  end
106
106
 
@@ -164,12 +164,12 @@ RUNNING_PS
164
164
  describe "when starting the service" do
165
165
  it "should call the start command if one is specified" do
166
166
  @new_resource.start_command("/etc/init.d/chef startyousillysally")
167
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef startyousillysally")
167
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef startyousillysally", default_env: false)
168
168
  @provider.start_service()
169
169
  end
170
170
 
171
171
  it "should call '/etc/init.d/service_name start' if no start command is specified" do
172
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} start")
172
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} start", default_env: false)
173
173
  @provider.start_service()
174
174
  end
175
175
  end
@@ -177,12 +177,12 @@ RUNNING_PS
177
177
  describe Chef::Provider::Service::Init, "stop_service" do
178
178
  it "should call the stop command if one is specified" do
179
179
  @new_resource.stop_command("/etc/init.d/chef itoldyoutostop")
180
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef itoldyoutostop")
180
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef itoldyoutostop", default_env: false)
181
181
  @provider.stop_service()
182
182
  end
183
183
 
184
184
  it "should call '/etc/init.d/service_name stop' if no stop command is specified" do
185
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} stop")
185
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} stop", default_env: false)
186
186
  @provider.stop_service()
187
187
  end
188
188
  end
@@ -190,13 +190,13 @@ RUNNING_PS
190
190
  describe "when restarting a service" do
191
191
  it "should call 'restart' on the service_name if the resource supports it" do
192
192
  @new_resource.supports({ :restart => true })
193
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} restart")
193
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} restart", default_env: false)
194
194
  @provider.restart_service()
195
195
  end
196
196
 
197
197
  it "should call the restart_command if one has been specified" do
198
198
  @new_resource.restart_command("/etc/init.d/chef restartinafire")
199
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} restartinafire")
199
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} restartinafire", default_env: false)
200
200
  @provider.restart_service()
201
201
  end
202
202
 
@@ -211,13 +211,13 @@ RUNNING_PS
211
211
  describe "when reloading a service" do
212
212
  it "should call 'reload' on the service if it supports it" do
213
213
  @new_resource.supports({ :reload => true })
214
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef reload")
214
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef reload", default_env: false)
215
215
  @provider.reload_service()
216
216
  end
217
217
 
218
218
  it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
219
219
  @new_resource.reload_command("/etc/init.d/chef lollerpants")
220
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef lollerpants")
220
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef lollerpants", default_env: false)
221
221
  @provider.reload_service()
222
222
  end
223
223
  end
@@ -225,7 +225,7 @@ RUNNING_PS
225
225
  describe "when a custom command has been specified" do
226
226
  before do
227
227
  @new_resource.start_command("/etc/init.d/chef startyousillysally")
228
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef startyousillysally")
228
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef startyousillysally", default_env: false)
229
229
  end
230
230
 
231
231
  it "should still pass all why run assertions" do
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@hjksolutions.com>)
3
- # Copyright:: Copyright 2008-2016, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2018, 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");
@@ -151,12 +151,12 @@ RUNNING_PS
151
151
  describe "when starting the service" do
152
152
  it "should call the start command if one is specified" do
153
153
  @new_resource.start_command("/usr/sbin/invoke-rc.d chef startyousillysally")
154
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef startyousillysally")
154
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d chef startyousillysally", default_env: false)
155
155
  @provider.start_service()
156
156
  end
157
157
 
158
158
  it "should call '/usr/sbin/invoke-rc.d service_name start' if no start command is specified" do
159
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start")
159
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start", default_env: false)
160
160
  @provider.start_service()
161
161
  end
162
162
  end
@@ -164,12 +164,12 @@ RUNNING_PS
164
164
  describe Chef::Provider::Service::Invokercd, "stop_service" do
165
165
  it "should call the stop command if one is specified" do
166
166
  @new_resource.stop_command("/usr/sbin/invoke-rc.d chef itoldyoutostop")
167
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef itoldyoutostop")
167
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d chef itoldyoutostop", default_env: false)
168
168
  @provider.stop_service()
169
169
  end
170
170
 
171
171
  it "should call '/usr/sbin/invoke-rc.d service_name stop' if no stop command is specified" do
172
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} stop")
172
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} stop", default_env: false)
173
173
  @provider.stop_service()
174
174
  end
175
175
  end
@@ -177,13 +177,13 @@ RUNNING_PS
177
177
  describe "when restarting a service" do
178
178
  it "should call 'restart' on the service_name if the resource supports it" do
179
179
  @new_resource.supports({ :restart => true })
180
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restart")
180
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restart", default_env: false)
181
181
  @provider.restart_service()
182
182
  end
183
183
 
184
184
  it "should call the restart_command if one has been specified" do
185
185
  @new_resource.restart_command("/usr/sbin/invoke-rc.d chef restartinafire")
186
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restartinafire")
186
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restartinafire", default_env: false)
187
187
  @provider.restart_service()
188
188
  end
189
189
 
@@ -198,13 +198,13 @@ RUNNING_PS
198
198
  describe "when reloading a service" do
199
199
  it "should call 'reload' on the service if it supports it" do
200
200
  @new_resource.supports({ :reload => true })
201
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef reload")
201
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d chef reload", default_env: false)
202
202
  @provider.reload_service()
203
203
  end
204
204
 
205
205
  it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
206
206
  @new_resource.reload_command("/usr/sbin/invoke-rc.d chef lollerpants")
207
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef lollerpants")
207
+ expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d chef lollerpants", default_env: false)
208
208
  @provider.reload_service()
209
209
  end
210
210
  end
@@ -82,13 +82,13 @@ XML
82
82
  allow(Etc).to receive(:getpwuid).and_return(@getpwuid)
83
83
  allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
84
84
  cmd = "launchctl list #{service_label}"
85
- allow(provider).to receive(:shell_out_with_systems_locale).
86
- with(/(#{su_cmd} '#{cmd}'|#{cmd})/).
85
+ allow(provider).to receive(:shell_out).
86
+ with(/(#{su_cmd} '#{cmd}'|#{cmd})/, default_env: false).
87
87
  and_return(double("Status",
88
88
  :stdout => launchctl_stdout, :exitstatus => 0))
89
89
  allow(File).to receive(:exists?).and_return([true], [])
90
- allow(provider).to receive(:shell_out_with_systems_locale!).
91
- with(/plutil -convert xml1 -o/).
90
+ allow(provider).to receive(:shell_out!).
91
+ with(/plutil -convert xml1 -o/, default_env: false).
92
92
  and_return(double("Status", :stdout => plutil_stdout))
93
93
  end
94
94
 
@@ -256,7 +256,7 @@ SVC_LIST
256
256
  it "calls the start command if one is specified and service is not running" do
257
257
  allow(new_resource).to receive(:start_command).and_return("cowsay dirty")
258
258
 
259
- expect(provider).to receive(:shell_out_with_systems_locale!).with("cowsay dirty")
259
+ expect(provider).to receive(:shell_out!).with("cowsay dirty", default_env: false)
260
260
  provider.start_service
261
261
  end
262
262
 
@@ -269,8 +269,8 @@ SVC_LIST
269
269
 
270
270
  it "starts service via launchctl if service found" do
271
271
  cmd = "launchctl load -w " + session + plist
272
- expect(provider).to receive(:shell_out_with_systems_locale).
273
- with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
272
+ expect(provider).to receive(:shell_out).
273
+ with(/(#{su_cmd} .#{cmd}.|#{cmd})/, default_env: false).
274
274
  and_return(0)
275
275
 
276
276
  provider.start_service
@@ -288,7 +288,7 @@ SVC_LIST
288
288
  it "calls the stop command if one is specified and service is running" do
289
289
  allow(new_resource).to receive(:stop_command).and_return("kill -9 123")
290
290
 
291
- expect(provider).to receive(:shell_out_with_systems_locale!).with("kill -9 123")
291
+ expect(provider).to receive(:shell_out!).with("kill -9 123", default_env: false)
292
292
  provider.stop_service
293
293
  end
294
294
 
@@ -301,8 +301,8 @@ SVC_LIST
301
301
 
302
302
  it "stops the service via launchctl if service found" do
303
303
  cmd = "launchctl unload -w " + plist
304
- expect(provider).to receive(:shell_out_with_systems_locale).
305
- with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
304
+ expect(provider).to receive(:shell_out).
305
+ with(/(#{su_cmd} .#{cmd}.|#{cmd})/, default_env: false).
306
306
  and_return(0)
307
307
 
308
308
  provider.stop_service
@@ -321,7 +321,7 @@ SVC_LIST
321
321
  it "issues a command if given" do
322
322
  allow(new_resource).to receive(:restart_command).and_return("reload that thing")
323
323
 
324
- expect(provider).to receive(:shell_out_with_systems_locale!).with("reload that thing")
324
+ expect(provider).to receive(:shell_out!).with("reload that thing", default_env: false)
325
325
  provider.restart_service
326
326
  end
327
327
 
@@ -285,12 +285,12 @@ describe Chef::Provider::Service::Openbsd do
285
285
  describe Chef::Provider::Service::Openbsd, "start_service" do
286
286
  it "should call the start command if one is specified" do
287
287
  new_resource.start_command("/etc/rc.d/chef startyousillysally")
288
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef startyousillysally")
288
+ expect(provider).to receive(:shell_out!).with("/etc/rc.d/chef startyousillysally", default_env: false)
289
289
  provider.start_service()
290
290
  end
291
291
 
292
292
  it "should call '/usr/local/etc/rc.d/service_name start' if no start command is specified" do
293
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{new_resource.service_name} start")
293
+ expect(provider).to receive(:shell_out!).with("/etc/rc.d/#{new_resource.service_name} start", default_env: false)
294
294
  provider.start_service()
295
295
  end
296
296
  end
@@ -298,12 +298,12 @@ describe Chef::Provider::Service::Openbsd do
298
298
  describe Chef::Provider::Service::Openbsd, "stop_service" do
299
299
  it "should call the stop command if one is specified" do
300
300
  new_resource.stop_command("/etc/init.d/chef itoldyoutostop")
301
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef itoldyoutostop")
301
+ expect(provider).to receive(:shell_out!).with("/etc/init.d/chef itoldyoutostop", default_env: false)
302
302
  provider.stop_service()
303
303
  end
304
304
 
305
305
  it "should call '/usr/local/etc/rc.d/service_name stop' if no stop command is specified" do
306
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{new_resource.service_name} stop")
306
+ expect(provider).to receive(:shell_out!).with("/etc/rc.d/#{new_resource.service_name} stop", default_env: false)
307
307
  provider.stop_service()
308
308
  end
309
309
  end
@@ -312,14 +312,14 @@ describe Chef::Provider::Service::Openbsd do
312
312
  context "when the new_resource supports restart" do
313
313
  let(:supports) { { restart: true } }
314
314
  it "should call 'restart' on the service_name if the resource supports it" do
315
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{new_resource.service_name} restart")
315
+ expect(provider).to receive(:shell_out!).with("/etc/rc.d/#{new_resource.service_name} restart", default_env: false)
316
316
  provider.restart_service()
317
317
  end
318
318
  end
319
319
 
320
320
  it "should call the restart_command if one has been specified" do
321
321
  new_resource.restart_command("/etc/init.d/chef restartinafire")
322
- expect(provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef restartinafire")
322
+ expect(provider).to receive(:shell_out!).with("/etc/init.d/chef restartinafire", default_env: false)
323
323
  provider.restart_service()
324
324
  end
325
325
 
@@ -107,7 +107,7 @@ NOMOCKINGSTRINGSPLZ
107
107
  describe "when starting the service" do
108
108
  it "should call the start command if one is specified" do
109
109
  @new_resource.start_command("#{@new_resource.start_command}")
110
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("#{@new_resource.start_command}")
110
+ expect(@provider).to receive(:shell_out!).with("#{@new_resource.start_command}", default_env: false)
111
111
  @provider.start_service()
112
112
  end
113
113
 
@@ -121,7 +121,7 @@ NOMOCKINGSTRINGSPLZ
121
121
  describe "when stopping a service" do
122
122
  it "should call the stop command if one is specified" do
123
123
  @new_resource.stop_command("/etc/init.d/themadness stop")
124
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/themadness stop")
124
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/themadness stop", default_env: false)
125
125
  @provider.stop_service()
126
126
  end
127
127
 
@@ -135,7 +135,7 @@ NOMOCKINGSTRINGSPLZ
135
135
  describe Chef::Provider::Service::Simple, "restart_service" do
136
136
  it "should call the restart command if one has been specified" do
137
137
  @new_resource.restart_command("/etc/init.d/foo restart")
138
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/etc/init.d/foo restart")
138
+ expect(@provider).to receive(:shell_out!).with("/etc/init.d/foo restart", default_env: false)
139
139
  @provider.restart_service()
140
140
  end
141
141
 
@@ -162,7 +162,7 @@ NOMOCKINGSTRINGSPLZ
162
162
 
163
163
  it "should should run the user specified reload command if one is specified" do
164
164
  @new_resource.reload_command("kill -9 1")
165
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("kill -9 1")
165
+ expect(@provider).to receive(:shell_out!).with("kill -9 1", default_env: false)
166
166
  @provider.reload_service()
167
167
  end
168
168
  end