diff options
author | Chris Doherty <cdoherty@getchef.com> | 2014-09-08 15:49:04 -0700 |
---|---|---|
committer | Chris Doherty <cdoherty@getchef.com> | 2014-09-10 16:34:30 -0700 |
commit | 2456f0c47df72268e1c73c9c5109771a59f10938 (patch) | |
tree | 198ae2e1136693d9dc28bab44ab272527195ec00 /lib/chef/provider/reboot.rb | |
parent | bfa023f1ba3e962a1d2c0179b4209ce44c734506 (diff) | |
download | chef-2456f0c47df72268e1c73c9c5109771a59f10938.tar.gz |
Rename actions to :request_reboot_on_successful_run and :reboot_interrupt_run.
Diffstat (limited to 'lib/chef/provider/reboot.rb')
-rw-r--r-- | lib/chef/provider/reboot.rb | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb index ffd5c5f936..a8abcb3b57 100644 --- a/lib/chef/provider/reboot.rb +++ b/lib/chef/provider/reboot.rb @@ -34,20 +34,32 @@ class Chef @current_resource end - def action_request + def request_reboot + node.run_context.request_reboot( + :delay_mins => @new_resource.delay_mins, + :reason => @new_resource.reason, + :timestamp => Time.now, + :requested_by => @new_resource.name + ) + end + + def action_request_reboot_on_successful_run converge_by("request a system reboot to occur if the run succeeds") do Chef::Log.warn "Reboot requested:'#{@new_resource.name}'" - node.run_context.request_reboot( - :delay_mins => @new_resource.delay_mins, - :reason => @new_resource.reason, - :timestamp => Time.now, - :requested_by => @new_resource.name - ) + request_reboot + end + end + + def action_reboot_interrupt_run + 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) end end def action_cancel - converge_by("cancel any existing system reboot request") do + converge_by("cancel any existing end-of-run reboot request") do Chef::Log.warn "Reboot canceled: '#{@new_resource.name}'" node.run_context.cancel_reboot end |