summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/client.rb4
-rw-r--r--lib/chef/platform/rebooter.rb2
-rw-r--r--lib/chef/provider/reboot.rb2
3 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index dbd26b26c0..457a67a98a 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -428,7 +428,9 @@ class Chef
run_context = setup_run_context
- converge(run_context)
+ catch (:interrupt_run_and_reboot) do
+ converge(run_context)
+ end
save_updated_node
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)
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index a8abcb3b57..f66b42c0e8 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -54,7 +54,7 @@ class Chef
converge_by("rebooting the system immediately") do
Chef::Log.warn "Rebooting system immediately, requested by '#{@new_resource.name}'"
request_reboot
- Chef::Platform::Rebooter.reboot!(node)
+ throw :interrupt_run_and_reboot
end
end