HomePhorge

(#13489) Synchronously start and stop services
dc5f57c2fc28Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#13489) Synchronously start and stop services

Previously, we were using the win32-service gem to start and stop
services. It uses Win32 APIs to programmatically send start and stop
requests. The actual service starts/stops asynchronously with respect
to the request. As a result, when refreshing a service, puppet would
issue a stop request, immediately followed by a start request, and that
would race as the service would often still be running when the start
request occurred, leading to 'An instance of the service is already
running'.

This commit changes the windows service provider to use net.exe to
start and stop services. This command will block until the service
start/stops, and returns 0 on success, making it easy to adapt to the
provider command pattern. The one downside is that the exit codes don't
have the same resolution that we can get via the sc.exe or by calling
the Service Control Manager programmatically. But that is not too
critical because we do capture the output of the net.exe command, e.g.
'The service name is invalid.' and include it in the exception message.

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUda36281f07a6: Updated manpages, CHANGELOG, puppet.spec, puppet.rb for 2.7.16rc1.
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPUdc5f57c2fc28: (#13489) Synchronously start and stop services (authored by Josh Cooper <josh@puppetlabs.com>).Jun 15 2012, 6:40 AM