(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.
(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) 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
(PUP-3244) Fixup test for windows and future parser

The test failed on windows nodes because the acceptance test wasn't
using the `puppet` method from beaker. The test failed on future parser
due to the bare file mode, in 4.0 only string modes will be allowed.

This commit fixes up those issues, and removes the
`acceptable_exit_codes => [0]` since that is the default behavior.
(PUP-3357) generate implicit names for ssh_authorized_keys if needed

Generated resources from the user type share an empty resource name
if more than one unmanaged key has no comment in the authorized_keys
file (the comment is used for the namevar). This leads to duplicate
declaration errors when the user tries to purge those keys through
the user { purge_ssh_keys } parameter.

Make the provider use an internal pseudo-name in such cases. Generated
resources get the same respective pseudo-name for successful purging.
It is composed of the file name and a numeric index.
(PUP-3357) unit tests for the purging of multiple unnamed keys

Just makes sure that the user type and ssh_authorized_keys provider
generate pseudo-names for keys following the same pattern.
(PUP-3357) integration test for purging of unnamed ssh authorized keys

Add an integration test with an ssh keyfile in which two keys have no name
and make sure that both are successfully purged.
Merge pull request #3164 from ffrank/ticket/3.7.x/PUP-3357-purge-unnamed-ssh-keys

(PUP-3357) purge unnamed ssh keys
(PUP-3334) Clear environment settings caches

Prior to this commit, environment settings were not being updated
when environment.conf was changed, even if environment timeout had
expired. This was because they were being cached in places in
Puppet.settings that were not being cleared.

Now, all the cached data for a particular environment is cleared
when the environment timeout expires.
(PUP-3334) Add test to ensure cache is cleared

In order to ensure that we don't encounter this issue again, add
a test case to environments_spec to ensure that the cache is being
properly cleared.

Additionally, fix a small bug in environment's list method where
a string should been converted to a symbol.