21760/22005 update preflight to delete old lib dir

In order to install in the top-level site_ruby directory, we need to clean out
any installs in the old site_ruby/1.8 location. We're doing this by setting a
variable in the package:apple task. If it's set, we remove all files there as
well as files in the new location.

While I'm here:
* update erb to strip leading and trailing spaces
* validate critical variables so a script is never generated with dangerous paths
* only target top-level files/dirs in lib, since we're doing rm -RF anyway
(#22206) Add option to disable default schedules
Use Dir.glob(), don't require rubygems or rake, use Dir.chdir as a block
use instance_variable_get instead of eval
(Maint) Remove whitespace errors

A lot of blank lines had picked up extra spaces.
(#21201) Remove thread-safety code

Puppet does not support running in any threaded environments. The thread
safety code that has been added has been, for the most part, haphazard
and not a holistic solution to the threading problem. There are many
areas that are not protected at all and others that were protected in
incomplete ways. The extra code and logic only caused more complication
in the codebase and is removed by this commit.
(#21201) Remove test for thread-safety

The functions test for thread safety, after many runs after having
removed the thread safety code, still did not fail. This removes the
test.
(#22250) ensure a failed resource status always has an event

Typically, a Puppet::Resource::Status.failed is set to true
when an event is added whose status is 'failure' (this is done
in Puppet::Resource::Status.add_event).  However, there is also
a case where Puppet::Transaction::ResourceHarness.evaluate
directly sets the status failed field to true.

Generate an event for this latter case, so that report parsers
can rely on an event accompanying any failed resource status.
Merge branch 'stable'

* stable:
  (packaging) Update PUPPETVERSION for 3.3.0-rc1
(maint) Limit ignore to root doc/ directory

'doc' was ignoring other 'doc' dirs elsewhere in the tree such as
acceptance/test/docs.  This should ensure we only ignore the
<repo-root>/doc directory.
(#22250) refactor previous and add spec tests
Merge pull request #1845 from kylog/issue/22250-reports-inconsistent

(#22250) ensure a failed resource status always has an event
(Maint) Mark AdditionalResourceGenerator as private
(#22229) Ensure generated resources contained

The generated resources were left out in the cold with respect to
containers: they had none at all. This changes that to make sure that
the generated resources (via #generate and #eval_generate) have the same
container as the resource that generated them.
(#22288) Add methods to access all parameters of a type

Without this commit there is no simple way to access all parameters of
a type. There is also no simple way to iterate over them. There is
currently a method that will return a list of all parameters that have a
value assigned, however, they are duplicates of the actual parameters. This
means there is no clear way to perform an operation on all parameters at once
that will have lasting side effects.

This commit adds functionality needed by the solution to ticket
(#22288).This functionality this commit adds includes a method to collect all
parameters that currently have a value assigned. This commit also adds a method
to iterate of the collected parameters that currently have a value. The intention
of these methods is to allow things like post catalog compilation hooks to be possible.
(#22229) Provide way of getting the container

The catalog tracks the relationship between the container and the
contained resource but did not provide any clear way to query for the
containment information. This adds a new method #container_of(resource)
that will return the container of the given resource, when one exists.
This removes some duplication around understanding what the container
is.
(21868) Move puppet libary target to /Library/Ruby/Site

We currently drop the puppet library files in /usr/lib/ruby/site_ruby/1.8 on
OSX, which is a symlink to /Library/Ruby/Site/1.8. As of OSX 10.9 Mavericks,
this will no longer work because it will be ruby 2.0.0. There are hard ways
and easy ways to solve this problem. A hard way would be to somehow
introspect the target host at install time, and then dynamically copy the
payload into the correct ruby version specific path. Another hard way would
be to create different OSX packages for different versions of OSX. Or, we
could pick the easy way, which is to just install into /Library/Ruby/Site
(the equivalent of /usr/lib/ruby/site_ruby). Since puppet will work on all
rubies shipped with supported versions of OSX, this will "just work".

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
(#22319) Correct Puppet::Setting's use of WatchedFile

WatchedFile was introduced after 3.2.0 as a new method of checking for
changes to file.  Puppet::Settings was calling a non-existent method on
the new WatchedFile, and would cause a daemonized Puppet to abort if one
of its watched configuration files was changed.

This is a minor change to call #to_str instead.
Merge pull request #1855 from zaphod42/issue/master/22229-ensure-generated-resources-contained

(#22229) Ensure generated resources contained
Merge pull request #1857 from jpartlow/issue/stable/22319-puppet-settings-misuses-watchedfile

(#22319) Correct Puppet::Setting's use of WatchedFile