(PUP-3201) Treat :undef as PNilType

For PUP-2857 :undef was changed from being a PNilType to a PRuntimeType.
This stopped the undef literal in the language from being able to be
assigned to Optional parameters. However, this only happened when the
undef was the default expression for the parameter.
(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.
(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.
Merge pull request #3187 from zaphod42/issue/stable/pup-3244-error-when-agent-uses-missing-env

(PUP-3244) Allow autoload to handle missing environment
(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
(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 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 pull request #3194 from zaphod42/issue/stable/pup-3201-undef-not-working

(PUP-3201) Treat :undef as PNilType