(PUP-2987) Windows service runinterval parsing

 - Refactor parsing code to a separate method to cleanup run loop
(PUP-2987) Restructure Windows service code

 - Move runinterval parsing and execution of the puppet agent to a new
   thread that maintains a busyloop until either:
    - the service is no longer running
    - an exception has occurred with parsing the runinterval
 - Rather than performing a wakeup against the main thread, simply kill
   this new thread on service_stop
 - Main service code will wait until the busyloop thread dies, then will
   exit
 - Note that this change is ultimately not responsible for the service
   hangs experienced in the service.  Additional changes have been made
   to the win32-service gem to ensure events being waited on with
   WaitForSingleObject are always signaled properly, even in failure
   cases.  Please see merged PR for more info:
   https://github.com/djberg96/win32-service/pull/21
   https://github.com/puppetlabs/puppet-win32-ruby/pull/51
Changing don't to does not because grammar
(PE-4848,PUP-2999) Modified test to use puppet_tmpdir
(PE-4848,PUP-2999) Fix tempdir perms for two tests
(PE-4848,PUP-2999) Disable expected failures
(PE-4848,PUP-2999) Disable expected failure
(PE-4848,PUP-2999) Change confines to skips
(PE-4848,PUP-2999) Don't run apache external test on jvm
(PE-4848,PUP-2999) Disable test for JVM Puppet
(PE-4848,PUP-2999) Disable ticket-7117 test since has dependency on dns_alt_names CA work
(PE-4848,PUP-2999) Skipping test for now, need support for DNS Alt names in JVM puppet
(PE-4848,PUP-2999) Change puppet_tmpdir to create_tmpdir_for_user

Reflects addition of create_tmpdir_for_user to Beaker DSL.

Signed-off-by: Wayne <wayne@puppetlabs.com>
(PE-4848,PUP-2999) Ensure temporary directories ownership is correct.

`master['user']` has a default value of `root` specified in Beaker::Host::Unix.
As it turns out, this is the config option containing the username used to log
in to SUTs.

It's better then to use `on master, 'puppet master --configprint user'` since
this will always give us the actual puppet user, whether it's `puppet` or
`pe-puppet` or something else.

Also, it's best to use the `create_tmpdir_for_user` method when initially
creating temporary directories on SUTs since `host.tmpdir` will always create
directories owned by root.

Signed-off-by: Wayne <wayne@puppetlabs.com>
(PUP-2999) Re-enable tests for jvm-puppet.

Since these tests were originally disabled, fixes have been made to jvm-puppet
such that the functionality they exercise has been implemented.

Signed-off-by: Wayne <wayne@puppetlabs.com>
(PUP-3032) Add setting to always cache `feature` load attempts

This commit adds a new setting, :always_cache_features, which affects
how we cache attempts to load Puppet 'features'.  If false, then
calls to `Puppet.features.<feature>?` will always attempt to load the
feature (which can be an expensive operation) unless it has already been
loaded successfully.  This makes it possible for a single agent run to,
e.g., install a package that provides the underlying capabilities for
a feature, and then later load that feature during the same run (even if
the feature had been tested earlier and had not been available).

If this setting is set to true, then features will only be checked once,
and if they are not available, the negative result is cached and returned
for all subsequent attempts to load the feature.  This behavior is almost
always appropriate for the server, and can result in a significant performance
improvement for features that are checked frequently.
(PUP-3030) Refactor 'store' report to use replace_file

There was some logic in the 'store' report processor that was
almost identical to the logic in 'puppet/util.rb''s 'replace_file'
method.  This commit refactors 'store' to re-use the existing
logic.
(PUP-3030) Port Util#replace_file to use our Tempfile

This simply changes the `replace_file` method to
use `Puppet::FileSystem::Tempfile`, rather than the
Ruby built-in `Tempfile`.  This will allow us to have
a bit more control over the lifecycle of these files
on the server.
(PUP-3030) Port P::U::Execution to use our Tempfile

This commit ports Puppet::Util::Execution over to use our
alternate implementation of Tempfile.  This will allow
us to have more explicit control over the life cycle of
these files on the server.
(PUP-3030) Flesh out implementation of P::F::Tempfile

This commit changes `Puppet::FileSystem::Tempfile` so that
it no longer subclasses the built-in `Tempfile`.  The goal
here is to give us more control over the life cycle of the
files when used on the server.

The implementation is based on the Ruby 1.9.3 implementation of
`Tempfile`, but strips out some things like the finalizer
and methods that we don't need / use.

Note that we had to also port over a few methods from `Dir` in
order to support ruby 1.8.7.  Relevant source code is here:

https://github.com/ruby/ruby/blob/v1_9_3_547/lib/tempfile.rb
https://github.com/ruby/ruby/blob/v1_9_3_547/lib/tmpdir.rb

In its current incarnation the class is probably poorly
named because it no longer makes any attempt to automagically
unlink the file at some point in the future.  I intend
to submit a follow-up commit that renames the class to make
this more obvious.