(maint) Move methods for creating downloaders to factory

Previously, the plugin_handler module was responsible for creating
downloaders and evaluating them. Since all of this happens within a
single method it is hard to test that the downloaders are created with
the correct set of properties. For example, we `ignore` source
permissions when downloading plugins, but we `use` source permissions
when downloading external facts, since those often contain scripts,
which must be executable.

This commit moves the logic for creating the downloaders to a factory
and updates the tests accordingly. As part of this change, the
PluginHandler module is changed to a class and is no longer mixed into
the Configurer.
(maint) Test that external fact syncing depends on external feature

Previously, the test was trying to verify that the downloader objects
were created with the correct arguments, and testing that the
downloader was evaluated twice (since the same downloader was used for
both pluginsync and facts).

However, the downloader_factory_spec now tests that downloader objects
are created correctly, e.g. based on Puppet[:plugindest], so it is not
necessary to repeat that here.

This commit modifies the test to ensure the Downloader#evaluate
methods are called for both downloader objects, and adds a test to
ensure we skip downloading facts if the external facts feature is
false.
(PUP-1527) After upgrade from 3.3.2-1 to 3.4.2-1 naginator fails to
create config from exported resources taken from hiera

Some changes introduced in hiera around 3.4 resulted in type coersion
from strings to FixNums when creating exported resources that were
partially built from hiera data.

This patch ensures that any non-array parameter passed through the
Nagios::Base.to_s is actually a string before trying to run the .sub
method on it, and so fixes the above error with exported resources
whilst also introducing support for fixnum params for any of the nagios
type parameters
(docs) Clarify possible exit codes and behavior with negative exit codes on Windows
Merge pull request #2879 from nfagerlund/docs_exec_exitcodes_windows

(docs) Clarify possible exit codes and behavior with negative exit codes on Windows
(PUP-3050) Update cfacter option for recent cfacter gem changes.

Now that cfacter implements the Ruby Facter interoperability layer, there
is no need for Puppet to "switch out" the Facter module for the CFacter
module.  libfacter itself will now expose a compatible Facter module in
C++.

Therefore, we no longer need facts.rb or the corresponding spec.
Instead, simply require cfacter and call CFacter.initialize.  This will
replace Ruby Facter with the libfacter implementation.
(PUP-3056) Restore Windows constants from mixins

 - Previously these constants were defined by using mixins from
   windows-pr.  As it turns out, while Puppet core does not need them,
   they are consumed by the ACL module.
(PUP-417) Make use of QENG-188 to restart puppet in acceptance

Versions of Beaker prior to the patch in QENG-188 relied on manually
starting and stopping puppet with a `puppet master *args` commandline
invocation followed by a `kill $puppet_pid`. To better mirror manual
smoke testing, we want to be able to start and stop puppet using the
service scripts provided by the installation packages, using `puppet
resource service` calls. We also want to be able to test Puppet from
packages that install with Passenger, relying on an apache restart.

These changes are all in Beaker, in QENG-188, but this commit is needed
to adjust puppet acceptance's setup steps to differentiate between a git
installation, a foss package installation, and a foss package
installation with passenger. Several tests were adjusted as well to be
agnostic between foss webrick/passenger installations, wherever
possible.

This commit also pins to Beaker ~> 1.17, which will pick up future
versions of Beaker < 2.0.  Beaker is smoke testing PRs against Puppet
acceptance, among other projects, so I think it's safe to stay
abreast of releases in the 1.y series.
Merge pull request #2871 from jpartlow/issue/master/pup-417-passenger-acceptance

(PUP-417) Make use of QENG-188 to restart puppet
(PUP-2907) Ignore source permissions on windows for fact sync

Previously, puppet on windows would always issue a warning:

    Copying owner/mode/group from the source file on Windows is
    deprecated; use source_permissions => ignore

Regardless of what was in the user's catalog. The reason is because
puppet applies an internal catalog to download external facts, and that
catalog contains a file resource whose source_permissions parameter is
set to `:use`.

This is done because external facts are often times scripts, which must
be executable for puppet to invoke them. See commit 21edcd67b for
PUP-2705.

This commit makes it so that source permissions for external facts are
ignored on Windows, while preserving existing behavior on other
platforms.

Permissions can be ignored on Windows, because puppet always has full
control of files it creates.
Merge pull request #2970 from kylog/joshcooper-ticket/master/PUP-2907

ticket/master/pup 2907
(PUP-3031) Move certification expiration check up

The http handler code contains a check to see if the expiration
date of the client certificate is within a certain window, so
that we can log a warning message if it will expire soon.

However, the mechanisms for handling this kind of check can
really vary depending on what web server you're running in, so
it doesn't make sense for this check to occur in a code path
that is common to all of the different web servers.

This commit simply moves the logic up into the code for
the individual web servers so that they will have the
ability to adjust the behavior according to their own
needs.
Merge pull request #2967 from Iristyle/ticket/master/PUP-3056-restore-constants-API-deprecations

(PUP-3056) Restore Windows constants from mixins
Merge pull request #2972 from cprice404/maint/master/PUP-3031-move-cert-expiration-check

(PUP-3031) Move certification expiration check up
Merge pull request #2965 from peterhuene/pup/3050

(PUP-3050) Update cfacter option for recent cfacter gem changes.
(PUP 229) Fix /etc/shadow parsing so that max/min_age is reported correctly

Before this patch, parsing /etc/shadow, when empty trailing fields were
present, they were discarded, and inturn a nil check was used to ensure that
the fields did not exist. However, this ran into trouble when a value was
appended to the end, causing all the empty fields to be returned as empty
strings instead, failing the nil checks.

This patch ensures that all empty fields are returned as empty strings, and
a check for empty string is used to check whether the field exists or not.
Merge pull request #2975 from vrthra/fix/pup229/maxage

(PUP 229) Fix /etc/shadow parsing so that max/min_age is reported correctly
Merge pull request #2933 from rdark/fix/master/pup1527

(PUP-1527) After upgrade from 3.3.2-1 to 3.4.2-1 naginator fails to crea...
(PUP-2349) Treat mode strings as octal

Previously there was logic to convert incoming mode using to_i,
but if it were a String that would convert the string as decimal,
whereas mode is always specified as octal. I don't know why the
to_i conversion was in there and whether it ever worked in a
meaningful way.

So fix this to convert Strings as octal.
(PUP-2349) Specify mode as a string containing an octal mode

Previously, mode was specified in some places as a Fixnum, in others
as a String. Consistently specify mode as a string containing octal.