puppetlabs/marionette-collective — pull request #176 by ploubser (2014-04-09 16:57:11+00:00)
Title: (MCO-221) - Refactor the runner class

The commit refactors the Runner class in the following ways.

The #run method has been reworked into #main_loop and #receiver_thread.
The main loop is responsible for keeping track of the internal state of
the runner and spawning and controlling the receiver thread.

The windows_daemon has been reworked to use the new main_loop and can
now stop, start, pause and resume correctly. When the daemon is paused
the service is still alive and will continue to process any agent
actions in flight but it will also disconnect and stop the receiver
thread, thereby keeping its internal state and being truely paused.

This commit also adds a new configuration option called soft_shutdown.
This is a Unix only feature and will not work on Windows hosts and when
set it will delay the exit of the daemon until all running agents have
either ran to completion or timed out.

This commit also extends the test coverage for the Runner class.