(Maint) Convert to new block expects
(#22471) Rescue errors specific to the YAML parser

The different yaml parsers, which are used in different versions of
ruby, end up throwing incompatible errors when loading data. The
Psych::SyntaxError that is thrown by the ruby 1.9 Psych parser is not
catchable by a generic `rescue => detail` block. Instead it needs to
explicitly call out the errors that need to be rescued.

This duplicates the error logic in Puppet::Indirector::Yaml.
(Maint) Simplify code

There was some unused code, overly complicated conditionals, and a use
of YAML that didn't use the built in writing to a stream.
(Maint) Stop asserting nothingness

Assertions that something doesn't raise an error, are not normally very
useful. In the case of these tests they only served to obscure the test
that was actually being done.
(#22471) Extract YAML interaction into shared code

The extra logic that is needed to interact with both Psych and Syck was
duplicated in the Puppet::Util::Storage and Puppet::Indirector::Yaml
classes. This pulls out a common module that wraps YAML and provides
consistent, and safe, semantics for using YAML for reading and writing.

This also removes the check ofr ::ArgumentError in addition to
::StandardError because it seems that ::ArgumentError is a sublcass of
::StandardError.
(#22471) Remove duplication by using Puppet::Util::Yaml

The new Puppet::Util::Yaml provides a common way of dealing with YAML
differences across ruby versions. This changes to two places in the
codebase that cared about these differences to use this common code.
(#22384) Log 404 and 406 responses at info

When the specific exception classes for HTTP control flow were
introduced, they ended up changing the logging from info to notice.
Notice is a much more severe level, which doesn't warrant having simple
file not found errors showing up at it. This changes the level back to
info.
(#22530) Support both YAML and PSON

The problem with the previous version of this code was that it only
allowed the report to support exactly what the user had selected. This
is alright (for the most part) for the agent, but is incorrect for the
master since the master needs to understand both formats at once. The
remedy this the default_format is now selected based on the
report_serialization_format setting whereas the supported_formats are
always both PSON and YAML.
Merge remote-tracking branch 'andy/issue/stable/22530-master-with-older-agent-sending-reports' into stable

* andy/issue/stable/22530-master-with-older-agent-sending-reports:
  (#22530) Support both YAML and PSON
(maint) Don't use subject in parsedfile spec
(#19994) Ensure that failed ParsedFile operations are marked flushed

Since ParsedFile maintains a global queue of records to be flushed and
attempts to flush all outstanding operations each time a resource is flushed,
any failed operations would be retried for each resource. This lead to
unrelated resources failing.
Merge pull request #1898 from pcarlisle/ticket/19994-parsedfile-flush-failed

Ensure failed ParsedFile operations are not retried for other resources
Merge pull request #1895 from zaphod42/issue/stable/22384-excessive-logging

(#22384) Log 404 and 406 responses at info
(#21975) Don't monkey patch Object#instance_variables

We were monkey patching Object#instance_variables to return symbols instead of
strings on ruby 1.8 which broke the use of SOAP. The patch was only used to
make it easier to do set operations when determining attributes to serialize
in zaml. This narrows the behavior of converting to symbols into the zaml code
so we don't have to override Object#instance_variables.
(#22471) Finish removing duplication of yaml exceptions

Remove a bit of code wasn't cleaned up but was no longer used.
Merge branch 'issue/stable/22471-corrupt-state-yaml' into stable

* issue/stable/22471-corrupt-state-yaml:
  (#22471) Finish removing duplication of yaml exceptions
  (#22471) Remove duplication by using Puppet::Util::Yaml
  (#22471) Extract YAML interaction into shared code
  (Maint) Stop asserting nothingness
  (Maint) Simplify code
  (#22471) Rescue errors specific to the YAML parser
  (Maint) Convert to new block expects
Merge remote-tracking branch 'patrick/ticket/21975-monkeying-around' into stable

* patrick/ticket/21975-monkeying-around:
  (#21975) Don't monkey patch Object#instance_variables
(Maint) TestHelper already clears global state

Previously, the specs were attempting to clear settings and storage
global state before/after each test, but this logic is now handled by
Puppet::Test::TestHelper, since specs often forget to do so, and leak
global state across specs.
(Maint) Don't keep Tempfile open while specs are running

Previously, the specs were creating a Tempfile instance in a before
block, writing to the file, but keeping the handle open, until the
after each block ran. This was done to ensure the Tempfile wasn't
deleted while the test was running.

Also the test for `File.rename` behavior would fail on Windows, because
a file cannot be renamed while any open handles to the file remain.

This commit changes the tests to use the PuppetSpec::Files methods for
generating a unique, temporary, and non-existent filename, and ensures
that any file/dir created during the test will be deleted, even if the
test fails during the run.
(Maint) Stop asserting nothingness

Previously, we were asserting that nothing was raised, when in this
case is not very useful.

Also changed the spec to use tmpfile, to ensure it is cleaned up after
the test runs.