summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2016-01-19 11:26:08 -0800
committerMatt Wrock <matt@mattwrock.com>2016-01-19 11:51:55 -0800
commiteacdbae976c05cccb6550d04f664034b9e66448f (patch)
tree89978620ad1860647175603f246b9a081c271807
parent600f83f177370adbd916666190989054d6fae1f0 (diff)
downloadchef-eacdbae976c05cccb6550d04f664034b9e66448f.tar.gz
explicitly adding .bat to service executable called by service in case users remove .bat from PATHEXT
-rw-r--r--lib/chef/application/windows_service.rb2
-rw-r--r--omnibus/resources/chef/msi/source.wxs.erb2
-rw-r--r--spec/unit/windows_service_spec.rb8
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 957123b1e9..a57cf138e4 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -196,7 +196,7 @@ class Chef
# Starts a new process and waits till the process exits
result = shell_out(
- "chef-client #{config_params}",
+ "chef-client.bat #{config_params}",
:timeout => Chef::Config[:windows_service][:watchdog_timeout],
:logger => Chef::Log,
)
diff --git a/omnibus/resources/chef/msi/source.wxs.erb b/omnibus/resources/chef/msi/source.wxs.erb
index f9c2b55cde..79f90ac18b 100644
--- a/omnibus/resources/chef/msi/source.wxs.erb
+++ b/omnibus/resources/chef/msi/source.wxs.erb
@@ -96,7 +96,7 @@
<File Id="RubyExecutable" Source="$(var.ProjectSourceDir)\embedded\bin\ruby.exe" KeyPath="yes" />
<ServiceInstall Name="chef-client" Type="ownProcess"
Start="auto" Vital="yes" ErrorControl="ignore"
- Arguments="[PROJECTLOCATION]\bin\chef-windows-service"
+ Arguments="[PROJECTLOCATION]bin\chef-windows-service"
DisplayName="!(loc.ServiceDisplayName)"
Description="!(loc.ServiceDescription)">
<ServiceDependency Id="Winmgmt" />
diff --git a/spec/unit/windows_service_spec.rb b/spec/unit/windows_service_spec.rb
index a614e6630d..6752b19a7b 100644
--- a/spec/unit/windows_service_spec.rb
+++ b/spec/unit/windows_service_spec.rb
@@ -51,7 +51,7 @@ describe "Chef::Application::WindowsService", :windows_only do
it "passes DEFAULT_LOG_LOCATION to chef-client instead of STDOUT" do
expect(subject).to receive(:shell_out).with(
- "chef-client --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
+ "chef-client.bat --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
shellout_options,
).and_return(shell_out_result)
subject.service_main
@@ -73,7 +73,7 @@ describe "Chef::Application::WindowsService", :windows_only do
it "uses the configured log location" do
expect(subject).to receive(:shell_out).with(
- "chef-client --no-fork -c test_config_file -L #{tempfile.path}",
+ "chef-client.bat --no-fork -c test_config_file -L #{tempfile.path}",
shellout_options,
).and_return(shell_out_result)
subject.service_main
@@ -90,7 +90,7 @@ describe "Chef::Application::WindowsService", :windows_only do
it "does not pass log location to new process" do
expect(subject).to receive(:shell_out).with(
- "chef-client --no-fork -c test_config_file",
+ "chef-client.bat --no-fork -c test_config_file",
shellout_options,
).and_return(shell_out_result)
subject.service_main
@@ -107,7 +107,7 @@ describe "Chef::Application::WindowsService", :windows_only do
it "passes watchdog timeout to new process" do
expect(subject).to receive(:shell_out).with(
- "chef-client --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
+ "chef-client.bat --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
shellout_options,
).and_return(shell_out_result)
subject.service_main