(pup-640) Update report schema for error events

Previously, special handling was added to synthesize a report
event even when the property application failed early. However,
when this change was made the report schema wasn't updated,
so the schema did not allow for several fields in the event
to be null (as they are for one of these synthesized events).

This change updates the report schema to reflect that certain
fields can be null. It also adds a spec test including an error
event, which requires the schema change in order to pass.
(maint) Add optional_parameter_count method to Closure

Add a method to return number of optional parameters on
Puppet::Pops::Evaluator::Closure just like Puppet::Parser::AST::Lambda
has.
(maint) Remove warning added during debugging
PUP-1450 Windows file resource Invalid DACL errors

 - When the source of a file resource is referred to through a symlink
   it's possible the volume for the real file does not support ACLs.
   Unfortunately it's not possible to simply readlink the path to
   determine the real path / volume, so the best thing to do is
   attempt to read the DACL of the file, catch the exception when it's
   invalid and fallback to default owner / group / mode on Windows.
 - Furthermore, under VirtualBox, the standard ERROR_INVALID_DACL is
   not the error that propagates, but rather ERROR_INVALID_FUNCTION, so
   there is special handling for that scenario.
 - Note that this particular issue also affects paths like the Puppet
   module path puppet:///modules that may be symlinked in environments
   like Vagrant.
PUP-1450 Honor source_permissions_ignore

 - In further debugging this failure, it was discovered that despite
   the :source_permissions parameter being set to :ignore on the file
   resource type, that we're still attempting to stat the source file
   and extract group / owner / mode.  So instead of trying to stat the
   file, catching errors, and falling back to defaults, we properly
   ignore the group / owner / mode of the source file and provide
   reasonable defaults on both Windows and Linux.
 - In Windows, the defaults continue to be
   :owner => 'S-1-5-32-544' (BuiltinAdministrators)
   :group => 'S-1-0-0' (Nobody)
   :mode => 0644
 - On other operating systems, the defaults are now set to be
   :owner => Process.euid
   :group => Process.egid
   :mode => 0644
 - Several tests were refactored to be less fragile with respect to the
   :source_permissions parameter
(PUP-1549) Use standard reason phrases on webrick

The webrick interface was using the body of the response for the reason
phrase for non-2xx responses. In the v1 api, this meant that we got
bizarre response headers. In the v2 api, it meant that we got json
formatted body data in the first header.

Not only was that state of affairs odd, it was also inconsistent with
the rack implementation, which didn't ever set the reason phrase. I am
also a little concerned that some clients might have choked on large
reason phrases (header too long issues).

This removes the setting of the reason phrase on webrick, which give us
back the standard reason phrases.
(PUP-1549) Update documentation showing reason phrase

All of the error responses that we had used as examples in the API
documentation had been taken from using webrick. Now that webrick is
consistent with rack, the docs need to be updated to show what the
responses should really look like.
Merge pull request #2315 from zaphod42/issue/master/pup-1549-v2-funky-response-phrase

(PUP-1549) Use standard reason phrases on webrick
(maint) Acceptance install_utils uses release rpm symlinks

The Puppet::Acceptance::InstallUtils was fiddling with extraneous
parsing trying to pick the current release rpm version from deep in
hierarchy of yum.puppetlabs.com.  Now we make use of the root symlinks.
(PUP-576) Update store_configs test for Debian

The store_configs/enc_provides_node_when_storeconfigs_enabled.rb test
has been updated to use Activerecord 3.2.x, but this version of
Activerecord no longer supports the sqlite3-ruby gem package available
on Debian via apt.  So we are installing the newer sqlite3 gem.  As an
added wrinkle, this is the same name as the core sqlite3 package on
Debian, running us afoul of PUP-1073 (duplicate names for packages
handled by different providers).  We are working around that with a
separate puppet apply for the sqlite3 installation.
Merge branch 'issue/master/pup-576-fixup-store_configs-test-for-debian'

* issue/master/pup-576-fixup-store_configs-test-for-debian:
  (PUP-576) Update store_configs test for Debian
  (maint) Acceptance install_utils uses release rpm symlinks
(pup-1524) Correct resource_present? to account for purged

The fix for http://projects.puppetlabs.com/issues/23081 included
e376b9d8, which refactored some of the resource_harness code and
introduced ResourceApplicationContext.resource_present?

At the time that method only checked current_values[:ensure] against
:absent, which meant that if current_values[:ensure] was :purged,
then resource_present? was true and the code thus attempted to
sync additional properties. This resulted in the double events
noted in this ticket (the first one in manage_via_ensure_if_possible,
the second (unnecessary) one in sync_if_needed).

This change adds a present? method to Puppet::Type, the default
implementation of which just checks for :ensure != :absent, but
which must be overridden by other types that have additional values
for :ensure that also imply that the resource is not present. It also
overrides that method in the package, file, and interface types,
each of which offer such additional values for :ensure.

In addition, there was another code path for duplicate events
because the previous code didn't distinguish between not using
ensure and the ensure check failing (e.g. due to a provider failure).
To address this, the code was refactored slightly to introduce
the NO_ACTION return from sync_if_needed.
Merge pull request #2307 from kylog/issue/pup-640/report-schema-updates-for-error-events

(pup-640) Update report schema for error events
(PUP-1066) Add the ability to delete files.
Add a .destory and .destroy? in order to flag files for deletion.
We also sneak in a .entries reader in order to let us read the
entries directly.

This should fix PUP-1066 and #12687.
Merge pull request #2321 from kylog/issue/stable/pup-1524/duplicate-events-for-some-providers

(pup-1524) Correct resource_present? to account for purged
(Maint) Extract re-usable resource matcher

Checking that catalogs have particular resources is useful. Let's make
it easier. This also adds parameter matching to the resource matcher.
(maint) Add how-to for destroying individual hosts
(PUP-865) Allow BlockExpression to evaluate everything

Previously BlockExpression would skip evaluating any AST nodes that
implement an instantiate method. The assumption was that instiate only
existed on Hostclass, Node, and Definition AST nodes and those same
classes also did not implement an evaluate method. With the introduction
of the PopsBridge::Program class, this entire house of assumption cards
came falling down, since it impelements both instantiate and evaluate.

The only thing that truly prevented BlockExpression from calling
evaluate was that the default evaluate implementation on Parser::AST
raised a Puppet::DevError to try to catch the case of evaluate not
being implemented for an AST class. Since Parser::AST is entirely
internal and missing an evaluate should show up very quickly in tests,
we can just as easily make evaluate a noop by default, which then
simplifies BlockExpression.

This change fixes the problem where the body of pp files were loaded,
but not evaluated when using the future evaluator and a directory of
manifest files. The problem was triggered by the BlockExpression logic
interacting with the PopsBridge::Program object and the structure
created by the Puppet::Pops::Parser::CodeMerger.
(PUP-865) Only use the pops merge for the future evaluator

The future evaluator is only really in play when both the parser is
future and the evaluator is future. The old check left out the evaluator
portion of that check and so ended up using the wrong CodeMerger when
using the current evaluator with the future parser.
(Maint) Clean up tests