diff options
author | Matt Wrock <matt@mattwrock.com> | 2015-10-20 16:27:02 -0700 |
---|---|---|
committer | Matt Wrock <matt@mattwrock.com> | 2015-10-20 16:27:02 -0700 |
commit | 29c01fd3235ba333b68ae1f6a972c049aec00c8c (patch) | |
tree | 9a418d932d5e806de6ff5c254f11f763e5a8c603 | |
parent | 4d35de670c9d54ad3b672e668672ba3256e2aef8 (diff) | |
download | chef-29c01fd3235ba333b68ae1f6a972c049aec00c8c.tar.gz |
add logger to windows service shelloutservice_logger
-rw-r--r-- | lib/chef/application/windows_service.rb | 6 | ||||
-rw-r--r-- | spec/unit/windows_service_spec.rb | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index b42a01cfdb..2551582c3a 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -189,7 +189,11 @@ class Chef config_params += " -c #{Chef::Config[:config_file]}" unless Chef::Config[:config_file].nil? config_params += " -L #{Chef::Config[:log_location]}" unless Chef::Config[:log_location] == STDOUT # Starts a new process and waits till the process exits - result = shell_out("chef-client #{config_params}", :timeout => Chef::Config[:windows_service][:watchdog_timeout]) + result = shell_out( + "chef-client #{config_params}", + :timeout => Chef::Config[:windows_service][:watchdog_timeout], + :logger => Chef::Log + ) Chef::Log.debug "#{result.stdout}" Chef::Log.debug "#{result.stderr}" rescue Mixlib::ShellOut::CommandTimeout => e diff --git a/spec/unit/windows_service_spec.rb b/spec/unit/windows_service_spec.rb index bc5e781c03..396584716d 100644 --- a/spec/unit/windows_service_spec.rb +++ b/spec/unit/windows_service_spec.rb @@ -49,7 +49,11 @@ describe "Chef::Application::WindowsService", :windows_only do allow(instance.instance_variable_get(:@service_signal)).to receive(:wait) allow(instance).to receive(:state).and_return(4) expect(instance).to receive(:run_chef_client).and_call_original - expect(instance).to receive(:shell_out).with("chef-client --no-fork -c test_config_file -L #{tempfile.path}", {:timeout => 7200}).and_return(shell_out_result) + expect(instance).to receive(:shell_out).with("chef-client --no-fork -c test_config_file -L #{tempfile.path}", + { + :timeout => 7200, + :logger => Chef::Log + }).and_return(shell_out_result) instance.service_main tempfile.unlink end @@ -63,7 +67,11 @@ describe "Chef::Application::WindowsService", :windows_only do allow(instance.instance_variable_get(:@service_signal)).to receive(:wait) allow(instance).to receive(:state).and_return(4) expect(instance).to receive(:run_chef_client).and_call_original - expect(instance).to receive(:shell_out).with("chef-client --no-fork -c test_config_file -L #{tempfile.path}", {:timeout => 10}).and_return(shell_out_result) + expect(instance).to receive(:shell_out).with("chef-client --no-fork -c test_config_file -L #{tempfile.path}", + { + :timeout => 10, + :logger => Chef::Log + }).and_return(shell_out_result) instance.service_main tempfile.unlink end |