diff options
Diffstat (limited to 'lib/chef/application')
-rw-r--r-- | lib/chef/application/apply.rb | 10 | ||||
-rw-r--r-- | lib/chef/application/windows_service.rb | 54 |
2 files changed, 32 insertions, 32 deletions
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb index c8c0c0eaf6..8d64c48102 100644 --- a/lib/chef/application/apply.rb +++ b/lib/chef/application/apply.rb @@ -213,11 +213,11 @@ class Chef::Application::Apply < Chef::Application end runner = Chef::Runner.new(run_context) catch(:end_client_run_early) do - begin - runner.converge - ensure - @recipe_fh.close - end + + runner.converge + ensure + @recipe_fh.close + end Chef::Platform::Rebooter.reboot_if_needed!(runner) end diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index 9f3781e8a1..770a5644ca 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -78,33 +78,33 @@ class Chef while running? # Grab the service_action_mutex to make a chef-client run @service_action_mutex.synchronize do - begin - Chef::Log.info("Next #{Chef::Dist::CLIENT} run will happen in #{timeout} seconds") - @service_signal.wait(@service_action_mutex, timeout) - - # Continue only if service is RUNNING - next if state != RUNNING - - # Reconfigure each time through to pick up any changes in the client file - Chef::Log.info("Reconfiguring with startup parameters") - reconfigure(startup_parameters) - timeout = Chef::Config[:interval] - - # Honor splay sleep config - timeout += rand Chef::Config[:splay] - - # run chef-client only if service is in RUNNING state - next if state != RUNNING - - Chef::Log.info("#{Chef::Dist::CLIENT} service is starting a #{Chef::Dist::CLIENT} run...") - run_chef_client - rescue SystemExit => e - # Do not raise any of the errors here in order to - # prevent service crash - Chef::Log.error("#{e.class}: #{e}") - rescue Exception => e - Chef::Log.error("#{e.class}: #{e}") - end + + Chef::Log.info("Next #{Chef::Dist::CLIENT} run will happen in #{timeout} seconds") + @service_signal.wait(@service_action_mutex, timeout) + + # Continue only if service is RUNNING + next if state != RUNNING + + # Reconfigure each time through to pick up any changes in the client file + Chef::Log.info("Reconfiguring with startup parameters") + reconfigure(startup_parameters) + timeout = Chef::Config[:interval] + + # Honor splay sleep config + timeout += rand Chef::Config[:splay] + + # run chef-client only if service is in RUNNING state + next if state != RUNNING + + Chef::Log.info("#{Chef::Dist::CLIENT} service is starting a #{Chef::Dist::CLIENT} run...") + run_chef_client + rescue SystemExit => e + # Do not raise any of the errors here in order to + # prevent service crash + Chef::Log.error("#{e.class}: #{e}") + rescue Exception => e + Chef::Log.error("#{e.class}: #{e}") + end end |