chef 14.1.12-universal-mingw32 → 14.2.0-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -6
- data/VERSION +1 -1
- data/chef.gemspec +2 -3
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
- data/lib/chef/cookbook/manifest_v0.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +3 -2
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
- data/lib/chef/http/auth_credentials.rb +5 -3
- data/lib/chef/http/authenticator.rb +6 -3
- data/lib/chef/knife.rb +3 -6
- data/lib/chef/knife/configure.rb +12 -8
- data/lib/chef/knife/raw.rb +6 -1
- data/lib/chef/mixin/shell_out.rb +16 -14
- data/lib/chef/provider/execute.rb +4 -3
- data/lib/chef/provider/git.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +5 -5
- data/lib/chef/provider/package/windows.rb +7 -0
- data/lib/chef/provider/package/yum.rb +7 -7
- data/lib/chef/provider/service/freebsd.rb +3 -3
- data/lib/chef/provider/service/init.rb +5 -5
- data/lib/chef/provider/service/macosx.rb +5 -4
- data/lib/chef/provider/service/simple.rb +4 -4
- data/lib/chef/provider/service/systemd.rb +13 -13
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +2 -0
- data/lib/chef/provider/systemd_unit.rb +4 -4
- data/lib/chef/provider/user.rb +18 -1
- data/lib/chef/provider/user/aix.rb +40 -8
- data/lib/chef/provider/user/dscl.rb +7 -14
- data/lib/chef/provider/user/linux.rb +1 -11
- data/lib/chef/provider/user/solaris.rb +57 -26
- data/lib/chef/provider/user/useradd.rb +4 -1
- data/lib/chef/provider/windows_task.rb +1 -0
- data/lib/chef/providers.rb +1 -2
- data/lib/chef/resource/execute.rb +4 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/hostname.rb +1 -1
- data/lib/chef/resource/sysctl.rb +3 -1
- data/lib/chef/resource/windows_ad_join.rb +16 -3
- data/lib/chef/resource_inspector.rb +13 -0
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +27 -1
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/functional/resource/windows_task_spec.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +1 -1
- data/spec/support/shared/unit/execute_resource.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
- data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
- data/spec/unit/cookbook_manifest_spec.rb +2 -0
- data/spec/unit/dsl/recipe_spec.rb +1 -5
- data/spec/unit/http/authenticator_spec.rb +33 -8
- data/spec/unit/mixin/shell_out_spec.rb +61 -1
- data/spec/unit/provider/apt_update_spec.rb +7 -7
- data/spec/unit/provider/execute_spec.rb +16 -15
- data/spec/unit/provider/git_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +12 -0
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/arch_service_spec.rb +9 -9
- data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/init_service_spec.rb +11 -11
- data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
- data/spec/unit/provider/service/macosx_spec.rb +11 -11
- data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/simple_service_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
- data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
- data/spec/unit/provider/service/windows_spec.rb +5 -0
- data/spec/unit/provider/systemd_unit_spec.rb +163 -118
- data/spec/unit/provider/user/dscl_spec.rb +2 -9
- data/spec/unit/provider/user/solaris_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -3
- data/spec/unit/provider_spec.rb +1 -5
- data/spec/unit/resource/apt_package_spec.rb +14 -0
- data/spec/unit/resource/apt_preference_spec.rb +14 -1
- data/spec/unit/resource/apt_repository_spec.rb +12 -3
- data/spec/unit/resource/apt_update_spec.rb +9 -0
- data/spec/unit/resource/bash_spec.rb +8 -0
- data/spec/unit/resource/bff_package_spec.rb +51 -0
- data/spec/unit/resource/breakpoint_spec.rb +4 -4
- data/spec/unit/resource/build_essential_spec.rb +5 -1
- data/spec/unit/resource/cab_package_spec.rb +10 -0
- data/spec/unit/resource/chef_gem_spec.rb +14 -0
- data/spec/unit/resource/chef_handler_spec.rb +9 -4
- data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
- data/spec/unit/resource/conditional_spec.rb +3 -3
- data/spec/unit/resource/cookbook_file_spec.rb +13 -2
- data/spec/unit/resource/cron_spec.rb +2 -7
- data/spec/unit/resource/csh_spec.rb +8 -0
- data/spec/unit/resource/directory_spec.rb +4 -9
- data/spec/unit/resource/dmg_package_spec.rb +8 -4
- data/spec/unit/resource/dnf_package_spec.rb +16 -1
- data/spec/unit/resource/dpkg_package_spec.rb +18 -0
- data/spec/unit/resource/dsc_resource_spec.rb +6 -6
- data/spec/unit/resource/dsc_script_spec.rb +39 -39
- data/spec/unit/resource/execute_spec.rb +20 -12
- data/spec/unit/resource/file_spec.rb +10 -10
- data/spec/unit/resource/freebsd_package_spec.rb +16 -0
- data/spec/unit/resource/gem_package_spec.rb +27 -0
- data/spec/unit/resource/git_spec.rb +17 -2
- data/spec/unit/resource/group_spec.rb +18 -17
- data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
- data/spec/unit/resource/homebrew_package_spec.rb +14 -0
- data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
- data/spec/unit/resource/hostname_spec.rb +10 -6
- data/spec/unit/resource/http_request_spec.rb +14 -0
- data/spec/unit/resource/ips_package_spec.rb +15 -3
- data/spec/unit/resource/ksh_spec.rb +8 -0
- data/spec/unit/resource/launchd_spec.rb +11 -5
- data/spec/unit/resource/link_spec.rb +6 -11
- data/spec/unit/resource/log_spec.rb +8 -8
- data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
- data/spec/unit/resource/macports_package_spec.rb +19 -0
- data/spec/unit/resource/mdadm_spec.rb +7 -3
- data/spec/unit/resource/mount_spec.rb +15 -18
- data/spec/unit/resource/msu_package_spec.rb +10 -0
- data/spec/unit/resource/ohai_hint_spec.rb +9 -8
- data/spec/unit/resource/ohai_spec.rb +11 -3
- data/spec/unit/resource/openbsd_package_spec.rb +14 -0
- data/spec/unit/resource/openssl_dhparam.rb +10 -5
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
- data/spec/unit/resource/osx_profile_spec.rb +7 -4
- data/spec/unit/resource/package_spec.rb +14 -0
- data/spec/unit/resource/pacman_package_spec.rb +17 -3
- data/spec/unit/resource/paludis_package_spec.rb +36 -0
- data/spec/unit/resource/perl_spec.rb +8 -0
- data/spec/unit/resource/portage_package_spec.rb +14 -0
- data/spec/unit/resource/powershell_package_spec.rb +14 -0
- data/spec/unit/resource/python_spec.rb +8 -0
- data/spec/unit/resource/reboot_spec.rb +5 -3
- data/spec/unit/resource/registry_key_spec.rb +12 -1
- data/spec/unit/resource/remote_directory_spec.rb +11 -1
- data/spec/unit/resource/remote_file_spec.rb +19 -0
- data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
- data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
- data/spec/unit/resource/rhsm_register_spec.rb +6 -1
- data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
- data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
- data/spec/unit/resource/route_spec.rb +4 -9
- data/spec/unit/resource/rpm_package_spec.rb +14 -0
- data/spec/unit/resource/ruby_block_spec.rb +12 -8
- data/spec/unit/resource/ruby_spec.rb +8 -0
- data/spec/unit/resource/scm_spec.rb +16 -8
- data/spec/unit/resource/script_spec.rb +8 -0
- data/spec/unit/resource/service_spec.rb +15 -0
- data/spec/unit/resource/smartos_package_spec.rb +18 -4
- data/spec/unit/resource/solaris_package_spec.rb +14 -0
- data/spec/unit/resource/subversion_spec.rb +14 -8
- data/spec/unit/resource/sudo_spec.rb +11 -4
- data/spec/unit/resource/swap_file_spec.rb +4 -5
- data/spec/unit/resource/sysctl_spec.rb +8 -10
- data/spec/unit/resource/systemd_unit_spec.rb +14 -12
- data/spec/unit/resource/template_spec.rb +19 -0
- data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
- data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
- data/spec/unit/resource/windows_env_spec.rb +8 -16
- data/spec/unit/resource/windows_feature.rb +27 -8
- data/spec/unit/resource/windows_feature_dism.rb +30 -9
- data/spec/unit/resource/windows_feature_powershell.rb +7 -7
- data/spec/unit/resource/windows_font_spec.rb +3 -4
- data/spec/unit/resource/windows_package_spec.rb +12 -2
- data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
- data/spec/unit/resource/windows_path_spec.rb +4 -5
- data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
- data/spec/unit/resource/windows_printer_spec.rb +12 -5
- data/spec/unit/resource/windows_service_spec.rb +24 -1
- data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
- data/spec/unit/resource/yum_repository_spec.rb +48 -2
- data/spec/unit/resource/zypper_package_spec.rb +51 -0
- data/spec/unit/resource/zypper_repository_spec.rb +56 -11
- data/spec/unit/resource_spec.rb +1 -5
- metadata +21 -12
- 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(:
|
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-
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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-
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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-
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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
|