diff options
author | Chris Doherty <cdoherty@getchef.com> | 2014-09-12 14:02:44 -0700 |
---|---|---|
committer | Chris Doherty <cdoherty@getchef.com> | 2014-09-12 14:02:44 -0700 |
commit | b6cc74645ead494c35d1ea4ecac1ce039fcd02b4 (patch) | |
tree | f87a68dde2bd60cb4c9821f853b732f3afb63778 | |
parent | b35e001755d9eaa78092f937dfa94002ef9ec349 (diff) | |
download | chef-b6cc74645ead494c35d1ea4ecac1ce039fcd02b4.tar.gz |
Improve the action and throw-label names.
-rw-r--r-- | lib/chef/client.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/reboot.rb | 6 | ||||
-rw-r--r-- | lib/chef/resource/reboot.rb | 7 | ||||
-rw-r--r-- | spec/functional/resource/reboot_spec.rb | 6 |
4 files changed, 12 insertions, 9 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 457a67a98a..161ecddb0f 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -428,7 +428,7 @@ class Chef run_context = setup_run_context - catch (:interrupt_run_and_reboot) do + catch (:end_client_run_early) do converge(run_context) end diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb index f66b42c0e8..8dde4653ec 100644 --- a/lib/chef/provider/reboot.rb +++ b/lib/chef/provider/reboot.rb @@ -43,18 +43,18 @@ class Chef ) end - def action_request_reboot_on_successful_run + def action_request_reboot converge_by("request a system reboot to occur if the run succeeds") do Chef::Log.warn "Reboot requested:'#{@new_resource.name}'" request_reboot end end - def action_reboot_interrupt_run + def action_reboot_now converge_by("rebooting the system immediately") do Chef::Log.warn "Rebooting system immediately, requested by '#{@new_resource.name}'" request_reboot - throw :interrupt_run_and_reboot + throw :end_client_run_early end end diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb index 44c04d25dc..d6caafdea8 100644 --- a/lib/chef/resource/reboot.rb +++ b/lib/chef/resource/reboot.rb @@ -18,6 +18,9 @@ require 'chef/resource' +# In using this resource via notifications, it's important to *only* use +# immediate notifications. Delayed notifications produce unintuitive and +# probably undesired results. class Chef class Resource class Reboot < Chef::Resource @@ -25,12 +28,12 @@ class Chef super @resource_name = :reboot @provider = Chef::Provider::Reboot - @allowed_actions = [:request_reboot_on_successful_run, :reboot_interrupt_run, :cancel] + @allowed_actions = [:request_reboot, :reboot_now, :cancel] @reason = "Reboot by Chef" @delay_mins = 0 - # no default action just now. + # no default action. end def reason(arg=nil) diff --git a/spec/functional/resource/reboot_spec.rb b/spec/functional/resource/reboot_spec.rb index 8e1ec80e8e..735ca994c8 100644 --- a/spec/functional/resource/reboot_spec.rb +++ b/spec/functional/resource/reboot_spec.rb @@ -59,7 +59,7 @@ describe Chef::Resource::Reboot do include_context 'testing run context modification' before do - resource.run_action(:request_reboot_on_successful_run) + resource.run_action(:request_reboot) end after do @@ -81,8 +81,8 @@ describe Chef::Resource::Reboot do it 'should have modified the run context correctly' do # this doesn't actually test the flow of Chef::Client#do_run, unfortunately. expect { - resource.run_action(:reboot_interrupt_run) - }.to throw_symbol(:interrupt_run_and_reboot) + resource.run_action(:reboot_now) + }.to throw_symbol(:end_client_run_early) test_reboot_action(resource) end |