(PUP-3355) Remove PSON document_type

This commit removes the encapsulation in the PSON serialization format.
Puppet only did this when using PSON on certain endpoints, other formats
like YAML or MsgPack never did this.

This is backwards compatible with older Puppet versions as they throw
away the info if it is there. But it is backwards incompatible for other
consumers of the PSON APIs.
(PUP-3355) Remove Puppet::Util::Pson

Remove the now unused Puppet::Util::Pson class.
(PUP-3244) ENC ignores missing directory environments

When using an ENC, if an environment that didn't exist was defined for a
node puppet would place the node into the production environment instead
of raising an error to alert the user that the environment that had been
requested did not exist.

This commit changes the behaviour when an environment is defined in an
ENC but does not actually exist. Instead of placing the node into the
production environment a Puppet::Environments::EnvironmentNotFound error
is raised.
(PUP-3244) Acceptance Tests for Nonexistent Environments

Added acceptance tests to test if an error is raised if an ENC specifies
a nonexistent environment for a node.
(PUP-3244) Validate Environment Before Setting

Before this commit the environment validation was happening for the Exec
terminus instead of on the node object itself. This fix should help all
node objects from having invalid environments when its environment is
set using `Puppet::Node#environment=`.
(PUP-3244) Add Puppet::Environment::Directories#get! method

This new function will return the directory environment or raise an
error if a directory environment does not exist. This gets rid of the
need to check if environments exist across the codebase before
continuing for the areas where we need.
(maint) Modify other uses of get() to get!()

There were several uses of get() that either immediately checked for nil
and raised the UnknownEnvironmentError or assumed non-nil and continued.
This changes all of those cases to use the new get!() method and so be
explicit that they require an environment. There are a couple uses that
still don't require the environment to exist.
Merge branch 'pr/3146' into stable

* pr/3146:
  (maint) Modify other uses of get() to get!()
  (PUP-3244) Add Puppet::Environment::Directories#get! method
  (PUP-3244) Validate Environment Before Setting
  (PUP-3244) Acceptance Tests for Nonexistent Environments
  (PUP-3244) ENC ignores missing directory environments

Closes GH-3146
(PUP-3244) Remove unnecessary Cached.get!

This removes a function that was provided by the super class.
(PUP-3244) Remove redundant methods and refactor.

Before this commit the Puppet::Environments::Cached#get! was not needed
as it was defined in a parent class. Puppet::Environments::Combined#get!
now calls get! in environment objects instead of assuming how get!
should work.

This commit also refactors areas in the code where
Puppet::Environments::EnvironmentNotFound was raised after calling get
in favor of the new get! method.
(PUP-3244) Remove unnecessary Cached.get!

This removes a function that was provided by the super class.
Merge pull request #3179 from ferventcoder/ticket/stable/PUP-3244-enc-cached-get

(PUP-3244) ENC directory environments - Remove unnecessary Cached.get!
Merge pull request #3182 from demophoon/fix/stable/pup-3244

(PUP-3244) ENC ignores missing directory environments
(DOC) Clarify resource_type api GET may be for a class, type or nodename

A GET resource_type may request a class, defined type or node by name.
The doc example was just :nodename, which led me briefly astray when I
was querying this endpoint; so I changed it to read
:class_type_or_node_name to make it a little clearer.
(PUP-3244) Allow autoload to handle missing environment

When a previous commit changed from get() to get!() the agent stopped
being able to use an environment that is available on the master, but
not available locally. I had misread the code and missed a trailing
`&&`. This caused me to think that the environment lookup in this case
was required, where in fact it is still optional.

This changes the structure of the code to make it much clearer that the
environment is optional, changes from get!() to get(), and adds some
tests around these code paths.
Merge pull request #3185 from jpartlow/maint/master/clarify-resource-type-api

(DOC) Clarify resource_type api GET may be for a class, type or nodename
(maint) Add "catalog_memory" benchmark to output heap and show mem info

This adds a benchmark "catalog_memory" that is running an empty catalog
(one call to log). A baseline sample of memory is taken at first run,
and at last. A diff of bound objects is produced. Two heap dumps in json
formats "diff.json", and "heap.json" are produced. The diff contains the
dump of each bound object, and the heap a dump of all objects.

The benchmark also prints basic information about memory.
(maint) Add memwalk.rake task that outputs a graph of bound objects

This adds a command that processes the dumped heap information
produced by "catalog_memory" benchmark (or other similar heap-dumps).

The result is a .dot file that can be rendered.

This tool is useful when tracking a memory leak.
(PUP-3345) Fix memory leak / remove cache of "non-deprecation" resource

A memory leak was introduced by caching all resource types that does
not handle deprecations (all types but one). This caused the problem
because the cache was held as a class instance variable and was never
evacuated.

This changes the Puppet::Resource class to not cache non-deprecation
resources.
(maint) Separate test for missing module directory

The test of behavior when a module directory is specified as part of an
environment but is missing on disk was hidden inside another test. This
splits it out and calls out that the behavior is that the directory is
simply ignored.