(PUP-3117) Allow multiple *=> in the same body and error on duplicate

This fixes a problem in the grammar that made it impossible to have
more than one *=> per body. 

This commit also adds a check for duplicate entries in the resulting
hash with the final set of parameter to value mapping.
(PUP-3117) Add tests for combination of default / hash
(maint) Make PuppetSpec::Language emit more helpful stack traces

This change was required to be able to see anything relevant regarding
where a problem originated. The fix is to patch the stacktrace
for failed expectencies. While not ideal there is very little that can
be done with Rspec 2 to fix this except reimplementing the support for
produces and fails to be matchers. (Rspec 3 has composable matchers that
may make this simpler).

A ticket has been logged about further improvements to the two support
functions (produces, and fails).
(PUP-3117) Complete the implementation of resource expression

This completes the implenentation of the Resource Expression.

* The LHS must now be a QualifiedName (i.e. file, notify), or
  a QualifiedReference (i.e. File, Notify), or an access expression
  with a left QualifiedReference (i.e. Resource[file]), or literal
  'class'

* The result of the LHS must be a CatalogEntry type, and it may not
  be detailed to title level.

* The * => syntax can be used to to unfold a hash. It may be used
  once per titled resource body. Attribute names must be unique across
  the attributes set with name => expr, and those set with * => hash.
(maint) Remove unused issue codes APPEND_FAILED, and DELETE_FAILED
(maint) Fix faulty issue ILLEGAL_NUMERIC_PARAMETER and validation

There was a typo in the message that referenced a non existing variable.
This was undetected because there was no test to cover this.

When testing the expected behavior, it was found that the validation
was not correct as it allowed parameters to have hexadecimal names, but
not octal names. Now all numeric parameter names are disallowed (they
cannot be used or addressed anyway).
(maint) Fix bad comment for issue ILLEGAL_VARIABLE_EXPRESSION
(PUP-3153) Guard against nil when closing Uniquefiles

In a recent commit we introduced `Uniquefile` to use in place
of `Tempfile` for certain code paths.  Because `Uniquefile` does
not automatically delete files for you, it is necessary to call
`close!` explicitly if you wish to make sure that they get
removed.

In the original commit I did this in a few places in an `ensure`
block.  However, I did not guard against the possibility that
an error might occur when attempting to instantiate the `Uniquefile`
object (e.g., file permissions error), and thus the calls to `close!`
in the `ensure` blocks may result in a NilClass exception (and also
mask the real error).

This commit adds guards to ensure that we only try to call `close!`
if the `Uniquefile` object was actually instantiated.
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-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