PUP-3155 Improve spec tests around the PE puppet version

Before this commit, when checking the puppet version on a PE build,
several characters; '(', ')' and '.'; caused problems with the regex.
This commit Regexp.escape-s them.
Merge pull request #3029 from cprice404/bug/master/PUP-3153-guard-against-nil-when-closing-uniquefiles

(PUP-3153) Guard against nil when closing Uniquefiles
Merge pull request #3031 from andersonmills/fix/master/PUP-3155-improve_pe_version_spec_tests

PUP-3155 Improve spec tests around the PE puppet version
(PUP-3157) Allow variable DNS name order in helpful error cert name test

This commit updates the
`helpful_error_message_when_hostname_not_match_server_certificate.rb`
test to allow for the order in which the DNS names are enumerated back
from the master server's certificate to be variable.  This allows the
test to not errantly fail depending upon the order in which the names
were actually signed into the certificate.
(PUP-3069) Add default manifest settings

Some Puppet installations do not use environment specific manifests
(particularly when an ENC is in use), however may still have global
setup required for all environments. For these installations it is
convenient to have a :default_manifest setting specified rather than
copying them manifest into every environment.

There are also installations which have a separation of roles between
users mainting the puppet master, puppet.conf and enc, and users making
per environment module changes. In these cases some Puppet installations
prefer to restrict the use of per environment manifests.

These two use cases were handled by setting the global manifest to a
non-interpolated path while setting the global modulepath to a path
interpolated with $environment.

With these settings being deprecated, directory environment
installations did not provide a means of preserving this functionality.

This patch addresses this by providing two new settings:

* default_manifest - is now the fallback manifest path if non is
specified in a given environment's environment.conf. It defaults to the
environment root relative path './manifests' which is the same default
that was previously hardset in early version of directory environments.
* restrict_environment_manifest - if set to true, enforces that
environments cannot define their own manifest setting, and validates
that default_manifest is set to an absolute path.

It is an initialization error if default_manifest is set to a string
that has an '$environment' to be interpolated within it.

We also log an error if restrict_environment_manifest is true and the
loaded environment's environment.conf has a manifest setting that
differs from the default_manifest setting.
(PUP-3069) Add spec test for new default options

Added tests for checking that default_manifest behaves properly when
given $environment. Also when restrict_environment_manifest is true with
a non-relative default_manifest.

This commit also fixed the hook on the :default_manifest setting to
validate that $environment was not present when setting the value.
(PUP-3069) Halt compile if environment has manifest conflict

Henrik brought up that with the new restrict_environment_manifest
setting set true, authors of modules in a particular environment
may be surprised by a manifest they have specified in their
environment.conf not being pulled in, leading to bad behavior when a
catalog is executed.  Although this is logged on the master, compilation
delivery and catalog execution is not prevented.

This commit will raise an exception on the master prior to catalog
compilation if it detect's a conflict between manifest settings in the
requested environment.
(PUP-3069) Add an integration spec for default_manifest

This adds integration testing of the new default_manifest and
restrict_environment_manifest settings.  It tests all the way from
Puppet initialization from actual puppet.conf files and
environment/manifest files through catalog compilation, simulating
Puppet master activity.  Since these settings are purely server-side
constructs, in that they do not impact the agent beyond the contents of
the final catalog the agent receives, I believe this is sufficient to
validate them.
(maint) Clear record of configured deprecated settings

We cache a list of deprecated settings that have been configured in the
initial parse_config, so that later initialization steps allow us to
read the :disable_warnings value, and then decide whether or not to
actually issue a particular warning.

But we weren't clearing this cache in the unsafe_clear call, which was
allowing this state to leak across specs.  Once we added that cache
clear to unsafe_clear, we then had to reorder parse_config steps for
unsafe_clear, followed by record_deprecations_from_puppet_conf(data).
(PUP-3163) Create and manage the mode of $reportsdir

For redhat and debian, we create and manage a $statedir with ownership
set to puppet:puppet. Unfortuntely, we also create a $reportsdir that is
owned by root. This means that other applications, even those in the
puppet group, could not write to this directory. This commits adds the
$reportsdir to both debian and redhat packaging to ensure it is created
with the correct permissions (just at the $statedir is), to ensure a
more consistent experience for users of our packages.
Merge pull request #3036 from melissaanne/ticket/master/fix-reportsdir-ownership

(PUP-3163) Create and manage the mode of $reportsdir
(PUP-3069) Change restrict_environment_manifest name

After discussion with Nick Fagerlund and Henrik Lindberg, changing
restrict_environment_manifest setting to
disable_per_environment_manifest to more clearly reflect what the
setting does.
Merge pull request #3024 from hlindberg/PUP-3117_resource-expression-splat-rocket-alt

(PUP-3117) Complete the Resource Expression implementation
(PUP-3069) Update default_manifest setting descriptions

Better descriptions of default_manifest and
disable_per_environment_manifest courtesy of Nick Fagerlund.
(PUP-3069) Test both future and current parser with default_manifest

Previously the environments/default_manifest_spec.rb was only running
with the current parser. This runs the set of tests for both the future
and current parser cases.
(PUP-2914) Remove 'gem install rgen' step now that it's vendored
(PUP-3069) Clear configuration_file for tests

The new default_manifest integration spec is parsing actual
configuration files and uncovered that our Settings do not clear the
@configuration_file data when #unsafe_clear is called.  This allows
parsed settings to leak across specs.

Specifically dropping the @configuration_file in the test helper
Settings#clear_everything_for_tests, resolves this, without changing the
behavior of the Settings#clear, and through it, the Puppet.clear
methods.
Merge pull request #3032 from jpartlow/feature/master/pup-3069-add-defaultmanifest

Feature/master/pup 3069 add defaultmanifest
(PUP-2349) Add windows specific expectation for deprecation_warning

Previously, the spec test assumed that no deprecation warnings would be issued.
However, the test relies on puppet using the `source_permissions` of the
source, and that behavior is deprecated on Windows. As a result, the test
was failing on Windows.

This commit updates the test to expect only the "Copying owner/mode/group/.."
deprecation warning on Windows, and no deprecation warnings on other platforms.
(PUP-2349) Add windows specific expectation for deprecation_warning

Previously, the spec test assumed that no deprecation warnings would be issued.
However, the test relies on puppet using the `source_permissions` of the
source, and that behavior is deprecated on Windows. As a result, the test
was failing on Windows.

This commit updates the test to expect only the "Copying owner/mode/group/.."
deprecation warning on Windows, and no deprecation warnings on other platforms.

Reviewed-by: Josh Partlow <joshua.partlow@puppetlabs.com>