diff options
author | Chris Doherty <cdoherty@ooyala.com> | 2014-09-03 11:50:34 -0700 |
---|---|---|
committer | Chris Doherty <cdoherty@getchef.com> | 2014-09-10 16:34:15 -0700 |
commit | 3d4b96deb09366abf6f55a92d7c63a70de8f1147 (patch) | |
tree | 85ce0d5ddc5e2e8deccb0fa25751b024cb6e7ee5 /lib/chef/provider/reboot.rb | |
parent | da7dddf3d43fffbc38fd48296eb5d4d34467e22d (diff) | |
download | chef-3d4b96deb09366abf6f55a92d7c63a70de8f1147.tar.gz |
Move reboot data into run_context. (Dan D. confirms his prior opinions from https://github.com/opscode/chef/pull/1279#discussion-diff-9964101.)
Diffstat (limited to 'lib/chef/provider/reboot.rb')
-rw-r--r-- | lib/chef/provider/reboot.rb | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb index f58a037347..3cfe576067 100644 --- a/lib/chef/provider/reboot.rb +++ b/lib/chef/provider/reboot.rb @@ -1,5 +1,4 @@ # -# Author:: Seth Chisamore (<schisamo@opscode.com>) # Author:: Chris Doherty <cdoherty@getchef.com>) # Copyright:: Copyright (c) 2014 Chef, Inc. # License:: Apache License, Version 2.0 @@ -31,9 +30,7 @@ class Chef class Provider class Reboot < Chef::Provider - # def whyrun_supported? - # true - # end + # TODO: support whyrun? def load_current_resource @current_resource ||= Chef::Resource::Reboot.new(@new_resource.name) @@ -44,21 +41,18 @@ class Chef end def action_request - Chef::Log.warn "Reboot requested: #{@new_resource.name}" - node.run_state[:reboot_requested] = true - node.run_state[:reboot_timeout] = @new_resource.timeout - node.run_state[:reboot_reason] = @new_resource.reason - node.run_state[:timestamp] = Time.now - node.run_state[:requested_by] = @new_resource.name + Chef::Log.warn "Reboot requested:'#{@new_resource.name}'" + node.run_context.request_reboot( + :reboot_timeout => @new_resource.timeout, + :reboot_reason => @new_resource.reason, + :timestamp => Time.now, + :requested_by => @new_resource.name + ) end def action_cancel - Chef::Log.warn "Reboot cancel: #{@new_resource.name}" - node.run_state.delete(:reboot_requested) - node.run_state.delete(:reboot_timeout) - node.run_state.delete(:reboot_reason) - node.run_state.delete(:timestamp) - node.run_state.delete(:requested_by) + Chef::Log.warn "Reboot canceled: '#{@new_resource.name}'" + node.run_context.cancel_reboot end end end |