(PUP-2631) Elide long URIs for 404 message

When the agent encounters a 404 response from the master and it has been
told to fail on 404, it previously output the entire path plus query
string that it requested. However, the most common case where this
occurs is when requesting a catalog, which can have a very long query
string if the request was done with a GET. This does not always occur
because even longer query strings will result in the agent using a POST
instead of a GET, which causes the long query string output problem to
go away.

In order to fix this the query string is now elided to 100 characters
(97 characters of the original text plus 3 periods).  In order to still
be able to debug any problems that might result from the query, however,
the query string is *not* elided if the log level is `debug`.
(PUP-1044) Make FileBucket::File use a local file whenever possible
(PUP-1044) Add info output for when file/string is used for checksum

This commit adds Puppet.info calls to make it possible to monitor the
number of file vs string checksum computations  They can be ovserved
when running in verbose mode.
(PUP-1044) Cleanup commented out code, and comments
(PUP-3032) Add setting to always cache `feature` load attempts

This commit adds a new setting, :always_cache_features, which affects
how we cache attempts to load Puppet 'features'.  If false, then
calls to `Puppet.features.<feature>?` will always attempt to load the
feature (which can be an expensive operation) unless it has already been
loaded successfully.  This makes it possible for a single agent run to,
e.g., install a package that provides the underlying capabilities for
a feature, and then later load that feature during the same run (even if
the feature had been tested earlier and had not been available).

If this setting is set to true, then features will only be checked once,
and if they are not available, the negative result is cached and returned
for all subsequent attempts to load the feature.  This behavior is almost
always appropriate for the server, and can result in a significant performance
improvement for features that are checked frequently.
(PUP-1044) Fix missing file mode in call to file system open

The mode 'nil' was accidentally dropped in the call to open the
file to get a stream. This caused 9 tests to fail.
(maint) Cleanup comment

The comment had trailing whitespace and a comma. It makes more sense
without either.
(maint) Extract language specification tools

The resource_expressions_spec contained a useful way of writing language
specification tests. This extracts those out so that they can be reused
in other places.
(PUP-3054) Ensure that inherits are absolute

PUP-121 was supposed to make all references to classes and resource
types absolute, but it looks like it missed a spot. The class referenced
in an inherits clause was not being looked up in an absolute manner,
which caused it to find the wrong parent class in certain cases. This
changes the future parser so that inherited classes are always absolute
names.
(maint) Express language tests in puppet language

This changes the tests of the puppet language, which should become part
of the language specification's example and test suite, to be entirely
expressed in the puppet language. This removes any dependency on ruby!
Well, any dependency on ruby for specifying the language tests.
(perf) Several small performance improvements

This removes some "dev mistake" error checking, which reduces the
overhead of some common calls. It also makes some calls less common,
most notably it caches the environment of a node when it wasn't
explicitly set and it falls back to using Puppet.lookup(:environments).
This can drastically reduce the number of environment lookups in some
situations. For the resource_expression_spec.rb tests, this resulted in
a 0.6 second improvement (~3 seconds to ~2.4 seconds).
(perf) Speed up setting lookup

One of the slowest thing for tests is setting values. They are reset and
changed often. This speeds up a few of the settings code paths by
removing unneeded method calls, either by introducing local variables,
or using delegators. In addition the ChainedValues objects are held on
to so that if the same environment and section is needed again it
doesn't need to be recreated.
(maint) Fix optimization that altered semantics for += production
(maint) Improve two test by checking they have no effect on catalog.

It is now possible by checking if the result of a "produce" had
no effect on the catalog by comparing against an empty array.
Merge branch 'zaphod42-issue/master/pup-3054-incorrect-lookup-in-inherits'
(PUP-3030) Refactor 'store' report to use replace_file

There was some logic in the 'store' report processor that was
almost identical to the logic in 'puppet/util.rb''s 'replace_file'
method.  This commit refactors 'store' to re-use the existing
logic.
(PUP-3030) Port Util#replace_file to use our Tempfile

This simply changes the `replace_file` method to
use `Puppet::FileSystem::Tempfile`, rather than the
Ruby built-in `Tempfile`.  This will allow us to have
a bit more control over the lifecycle of these files
on the server.
(PUP-3030) Port P::U::Execution to use our Tempfile

This commit ports Puppet::Util::Execution over to use our
alternate implementation of Tempfile.  This will allow
us to have more explicit control over the life cycle of
these files on the server.
(maint) Use tlsv1 when curling the master from another agent

Various acceptance tests curl the puppet master, and rely on the
installed openssl lib.  With the inclusion of PUP-417, we began
installing the puppetmaster-passenger packages on debian, which
ultimately rely on updated openssl packages being installed on the
puppet master node.  If the agent platfrom was old enough to be using
openssl 0.9.8 (lucid for example), several curl tests began failing
because they were attempting to connect with sslv2 and being rejected.

This patch updates the five failing tests to be explicit about requiring
--tlsv1.
(PUP-3030) Flesh out implementation of P::F::Tempfile

This commit changes `Puppet::FileSystem::Tempfile` so that
it no longer subclasses the built-in `Tempfile`.  The goal
here is to give us more control over the life cycle of the
files when used on the server.

The implementation is based on the Ruby 1.9.3 implementation of
`Tempfile`, but strips out some things like the finalizer
and methods that we don't need / use.

Note that we had to also port over a few methods from `Dir` in
order to support ruby 1.8.7.  Relevant source code is here:

https://github.com/ruby/ruby/blob/v1_9_3_547/lib/tempfile.rb
https://github.com/ruby/ruby/blob/v1_9_3_547/lib/tmpdir.rb

In its current incarnation the class is probably poorly
named because it no longer makes any attempt to automagically
unlink the file at some point in the future.  I intend
to submit a follow-up commit that renames the class to make
this more obvious.