(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-3393) Minor typo fix in relationship_spec.rb

There were a couple of typos relating to ALL_EVENTS in
relationship_spec.rb.
(PUP-2995) Move custom oid mapping file management to application/master.rb

* As suggested by @adrienthebo, custom oid management was moved to application/*.
* Custom oid management is only involved if `trusted_node_data` is activated.
(PUP-2995) Change custom OID format and apply code advices.

* As suggested by @ffrank, custom OID file format was changed to use Hash structure.
* Apply code modifications suggested by @ferventcoder.
(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.
(PUP-3355) Skip object creation during PSON parsing

The previous commits prevented newer agents from being able to parse
PSON responses from older masters, which use the "short" registered
document type name. For example, the node response message from an older
master contains "document_type":"Node", and the agent would fail to
PSON.parse it, because it no longer registers document types.

This commit removes the logic from the PSON parser for constructing
arbitrary object types, based on document_type or otherwise. This way
the PSON parser just returns safe object types (Hash, Array, or
primitive). If the master's response includes a "data" envelope with
a document_type, it will be returned in the parsed data, and promptly
ignored by the PSON format handler.
(maint) Make catalog_memory a noop unless running on 2.1.0.

This makes the catalog_memory benchmark print a message about
2.1.0 being required and then exit with -1 unless the ruby version
is >= than 2.1.0.
(maint) Always use a remote env in the configurer

Before this commit the configurer would track the appropriate
environment to request from the master in the `@environment` variable.
This contained simply the name of the remote environment. The value was
passed through to various indirection requests as the `:environment`
parameter. However, as part of PUP-3244, something changed that caused
the configurer to begin failing when
  * The requested environment did not exist remotely
  * There was a cached catalog locally
  * The cached catalog referenced an environment that did not exist
    locally
This situation caused the indirector requests to contain an environment
name that the Puppet::Indirector::Request code would then try to expand
into a full environment instance by calling
`Puppet.lookup(:environments).get!(env)`. However, since the environment
didn't exist locally the `get!` method raised an error.

This commit changes it so that the configurer always converts the
`@environment`, which is always the environment from the server for the
current run, to `Puppet::Node::Environment.remote`. This stops
`Puppet::Indirector::Request` from trying to load the environment
locally.

I don't know how this ever worked...
Merge pull request #3191 from zaphod42/maint/stable/agent-errors-on-invalid-env-in-cached-catalog

(maint) Always use a remote env in the configurer
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (maint) Always use a remote env in the configurer
(maint) Fix typo in test name
(PUP-3244) Add a hashbang line to the acceptance test enc

Ruby's Kernel.exec has different behavior on different platforms when
handling a script without a hashbang line. On rhel6, for instance:

[root@a3m9lej0pifviyl ~]# cat /root/test
echo 'foo'
[root@a3m9lej0pifviyl ~]# /root/test arg
foo
[root@a3m9lej0pifviyl ~]# irb
irb(main):001:0> exec('/root/test', 'arg')
Errno::ENOEXEC: Exec format error - /root/test
        from (irb):1:in `exec'
        from (irb):1
        from :0

This seems to depend on how the underlying platforms exec functions
handle this case. Rewriting the enc as a ruby file with a hashbang line
sidesteps this issue and allows the test to run. Also dropped the
environment.conf usage since it seemed superfluous.
(maint) Allow catalog_memory to be skipped on < 2.1.0

The previous attempt to skip catalog_memory on < 2.1.0 caused the `rake
benchmark:all:run` task to abort because of a failed command. By
changing the exit to 0, rake is allowed to continue.
Merge pull request #3188 from hlindberg/PUP-3345-memory-leak

(PUP-3345) Fix memory leak (and add some tooling to find leaks)
Merge pull request #3193 from jpartlow/issue/stable/pup-3244-acceptance-enc-needs-hashbang

Issue/stable/pup 3244 acceptance enc needs hashbang
Merge branch 'issue/stable/pup-3244-acceptance-enc-needs-hashbang' into stable

* issue/stable/pup-3244-acceptance-enc-needs-hashbang:
  (PUP-3244) Add a hashbang line to the acceptance test enc
  (maint) Fix typo in test name
Merge branch 'stable'

* stable:
  (maint) Allow catalog_memory to be skipped on < 2.1.0
  (maint) Make catalog_memory a noop unless running on 2.1.0.
  (PUP-3345) Fix memory leak / remove cache of "non-deprecation" resource
  (maint) Add memwalk.rake task that outputs a graph of bound objects
  (maint) Add "catalog_memory" benchmark to output heap and show mem info