summaryrefslogtreecommitdiff
path: root/lib/chef/platform
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@getchef.com>2014-09-09 14:45:59 -0700
committerChris Doherty <cdoherty@getchef.com>2014-09-10 16:34:31 -0700
commitb35e001755d9eaa78092f937dfa94002ef9ec349 (patch)
tree9deb8a2fb2f2b72f7147fe8d9afd02f886b31b40 /lib/chef/platform
parent6d3aa8327224e25d6011b46b8873cab5e7a56031 (diff)
downloadchef-b35e001755d9eaa78092f937dfa94002ef9ec349.tar.gz
Re-implement immediate reboot using throw/catch, so all the end-of-run
tasks (e.g. report handlers) still get to run.
Diffstat (limited to 'lib/chef/platform')
-rw-r--r--lib/chef/platform/rebooter.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/chef/platform/rebooter.rb b/lib/chef/platform/rebooter.rb
index 08224b4d77..b46f0e394c 100644
--- a/lib/chef/platform/rebooter.rb
+++ b/lib/chef/platform/rebooter.rb
@@ -31,6 +31,7 @@ class Chef
reboot_info = node.run_context.reboot_info
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]} /c \"#{reboot_info[:reason]}\""
else
# probably Linux-only.
@@ -41,6 +42,7 @@ class Chef
shell_out!(cmd)
end
+ # this is a wrapper function so Chef::Client only needs a single line of code.
def reboot_if_needed!(node)
if node.run_context.reboot_requested?
reboot!(node)