(PUP-3701) Fix issue with empty exported resources expression

Resources in the catalog were being ignored and only found through the
indirector. This patch fixes that and makes the PuppetDB tests using
this feature pass.
Merge pull request #3344 from senior/ticket/stable/pup-3701-empty-resource-collection-expression

(PUP-3701) Fix issue with empty exported resources expression
(maint) No longer necessary to gem install rgen

Puppet used to express gem dependencies on rgen in its Gemfile, packaging,
etc, but in PUP-2914 the rgen code was vendored into puppet, and the
dependencies removed.

However, the future parser setup step still tried to install the rgen
gem, but only when testing against git checkouts (effectively Solaris
and Windows).

Since rgen is vendored in puppet, it is not necessary to install the gem
during future parser testing.
Merge pull request #3365 from joshcooper/maint/stable/remove-rgen-install

(maint) No longer necessary to gem install rgen
(maint,QENG-174) Allow installing a new puppet package on top of the PE tar

Currently, when running the puppet acceptance tests against PE, you
can only test the version of puppet that is shipped with the PE
tarball. This adds another step to the PE pre-suite which will install
an arbitrary version of pe-puppet on top of the installed PE tarball.
Merge pull request #3366 from branan/QENG-174

(maint,QENG-174) Allow installing a new puppet package on top of the PE tar
(PUP-3479) (PUP-3737) Update Windows ffi ~> 1.9.5

Ruby 2.1.3 on Windows requires ffi 1.9.5. Update our Windows dependencies
to allow 1.9.5+ to be selected.

This commit was originally merged to the master branch targeted at 4.x,
when it should have been targeted first at the stable branch to affect
the 3.7.x release and keep it in sync with Facter 2.3.0, which now
requires ffi ~> 1.9.5

Gem installation of Puppet on Windows is thus currently broken until
Puppet 3.7.4 ships or a workaround is employed, where Facter 2.2.0 is
installed by gem prior to installing Puppet.
Merge pull request #3378 from Iristyle/ticket/stable/PUP-3479-update-FFI-dependency-1.9.5

(PUP-3479) (PUP-3737) Update Windows ffi ~> 1.9.5
(PUP-3728) Fix off by one error in cron month names

When a name, such as "January", is used to specify a month in the Cron type,
the resulting numeric value would be off by one (i.e. "0"). This is because
month is unique among "namable" crotab entries in that it does not use 0-based
indexing. This patch updates the spec tests to enforce this expectation and
fixes the issue by padding out the list of acceptable month names so that
indices start at 1.
Merge pull request #3380 from Sharpie/PUP-3728-fix-cron-monthnames

(PUP-3728) Fix off by one error in cron month names
(PUP-3739) Don't require master to have agent role

Previously, when executing acceptance tests from a git checkout, the
master host also needed to have the agent role. This is because the
010_TestSetup step only created `/etc/puppet/puppet.conf` for agents.

If you tried to run against a master host that didn't have the agent
role, then puppet.conf was never created. So later when trying to start
the master via `with_puppet_running_on`, beaker would try to back up the
old `puppet.conf`, warn that it didn't exist:

    Warning: Could not backup file '/etc/puppet/puppet.conf': no such file

Then it would try to read in the old `puppet.conf`, to apply the new
settings on top, but that failed with:

    cat: /etc/puppet/puppet.conf: No such file or directory

This commit updates the setup step to ensure the parent directory and
puppet.conf both exist.

The sslv2_downgrade_master test had to be updated to handle the case
where there are no suitable agents, e.g. windows agent doesn't have
openssl in its PATH, and the master doesn't have an agent.

The ticket_3360_allow_duplicate_csr_with_option_set test required at
least one non-Windows agent. It was last updated a long time ago when
facter on windows didn't support the fqdn fact. The test also wasn't
using the `puppet` helper method that prefixes the command with
`cmd.exe /c`.
(PUP-3389) Do not list all directories when getting an environment

The Puppet::Environment::Directories loader had a stable but naive
implementation for obtaining a valid directory env.  It relied on its
list function to provide the set of all valid directory environments in
its root directory, and then returned the one that matched.  This worked
fine for small numbers of directory environments, but became costly for
hundred or thousands of environments.  The impact was exacerbated by the
need to lookup the environment.conf for each directory environment, in
the context of a Puppet::Settings values object that could interpolate
the settings in the environment.conf.  Each such lookup relied on yet
another pass through the list of all directory environments, causing
num_of_direnvs^2 calls for each initial lookup of a new environment.

This commit fixes that, separating validation of a directory environment
entry and creation of a new environment from the act of listing all
valid directory environments.

A benchmark is added as well, testing the time it takes to look up one
environment out of a thousand available environments after base settings
initialization.

Prior to this patch, 10 passes of the benchmark test took ~100s on a
4 core Intel 2.9Ghz machine with 8GB.  After the patch, it's down to
about 0.01s, so about a 10^4 boost...which is probably the best
performance boost I've ever managed out of fairly minor patch :)

Conflicts:
	lib/puppet/environments.rb
Merge pull request #3388 from hlindberg/PUP-3389_cherry-pick-fix-to-stable

(PUP-3389) Do not list all directories when getting an environment
Merge pull request #3391 from joshcooper/ticket/stable/PUP-3739-dont-require-master-to-be-agent

(PUP-3739) Don't require master to have agent role