summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorChristoph <cgriesshammer@gmail.com>2016-12-06 17:19:20 -0500
committerBryan McLellan <btm@loftninjas.org>2016-12-06 17:19:20 -0500
commit205eb04f3e50216d2e1014ffbe8545fba6868890 (patch)
tree4d068ac5c04257f9e5ee3cbdc929c09107443149 /lib/chef
parent8d127b7d9ce31581de8f367bbbff8eb3fd0e24f3 (diff)
downloadchef-205eb04f3e50216d2e1014ffbe8545fba6868890.tar.gz
Ensures correct version of shutdown is called when using the reboot resource on Windows (#5596)
Use a fixed path to shutdown.exe on windows in Chef::Platform::Rebooter, fixes #5594 Signed-off-by: Christoph Griesshammer <cgriesshammer@gmail.com>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/platform/rebooter.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/platform/rebooter.rb b/lib/chef/platform/rebooter.rb
index 74c8b2da1f..6829b66539 100644
--- a/lib/chef/platform/rebooter.rb
+++ b/lib/chef/platform/rebooter.rb
@@ -35,7 +35,9 @@ class Chef
cmd = if Chef::Platform.windows?
# should this do /f as well? do we then need a minimum delay to let apps quit?
- "shutdown /r /t #{reboot_info[:delay_mins] * 60} /c \"#{reboot_info[:reason]}\""
+ # Use explicit path to shutdown.exe, to protect against https://github.com/chef/chef/issues/5594
+ windows_shutdown_path = "#{ENV['SYSTEMROOT']}/System32/shutdown.exe"
+ "#{windows_shutdown_path} /r /t #{reboot_info[:delay_mins] * 60} /c \"#{reboot_info[:reason]}\""
else
# probably Linux-only.
"shutdown -r +#{reboot_info[:delay_mins]} \"#{reboot_info[:reason]}\""