diff options
Diffstat (limited to 'lib/chef/provider/service/windows.rb')
-rw-r--r-- | lib/chef/provider/service/windows.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb index 88bb282be9..98aad4fe29 100644 --- a/lib/chef/provider/service/windows.rb +++ b/lib/chef/provider/service/windows.rb @@ -95,17 +95,17 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service shell_out!(@new_resource.start_command) else spawn_command_thread do - begin - Win32::Service.start(@new_resource.service_name) - rescue SystemCallError => ex - if ex.errno == ERROR_SERVICE_LOGON_FAILED - logger.error ex.message - raise Chef::Exceptions::Service, - "Service #{@new_resource} did not start due to a logon failure (error #{ERROR_SERVICE_LOGON_FAILED}): possibly the specified user '#{@new_resource.run_as_user}' does not have the 'log on as a service' privilege, or the password is incorrect." - else - raise ex - end + + Win32::Service.start(@new_resource.service_name) + rescue SystemCallError => ex + if ex.errno == ERROR_SERVICE_LOGON_FAILED + logger.error ex.message + raise Chef::Exceptions::Service, + "Service #{@new_resource} did not start due to a logon failure (error #{ERROR_SERVICE_LOGON_FAILED}): possibly the specified user '#{@new_resource.run_as_user}' does not have the 'log on as a service' privilege, or the password is incorrect." + else + raise ex end + end wait_for_state(RUNNING) end |