(PUP-1362) (PUP-1775) Use yum check-updates for latest yum packages

Early versions of the yum package provider used `yum list available` to
determine the latest version of packages that were `ensure => latest`.
However the versions of yum available around that time changed the
output formatting of yum, which meant that the parsing code would break
on a regular basis (#836).

Commit 8722e439 resolved this by using the yum python bindings to
interact with yum. This required shipping a python helper script to
provide the interface between Puppet and the python libraries. However
this opened up a host of other issues ranging from what version of
Python is symlinked to '/usr/bin/python', how the yum database is
locked, and so on (PUP-1362, #11380, #16623). In addition changes to
yumhelper.py were very hard to test or reason about since it doesn't
neatly plug into our existing tests.

This commit removes yumhelper.py and replaces the update checks by
calling `yum check-update`. The output format of this command has not
changed since CentOS 4 and works all the way up to RedHat 7 so we should
be able to rely on this for a while.
(docs) Note that the path setting only works in main section of puppet.conf

See PUP-3023 for more info.
(PUP-2452) Refresh support for Package type

This is implemented behind a feature that each provider must
implement. It is intended to allow source distributions to
recompile packages on a notify or subscribe event.

It allows patterns like:

    package { "app-admin/nginx":
       ensure       => latest,
       hasreinstall => true,
       subscribe    => File['/path/to/nginx/compile/options'];
    }
(PUP-3227) Address man page ownship conflicts

Prior to this commit, upgrading from puppet=2.7.23-1~deb7u3 and
puppetmaster=2.7.23-1~deb7u3 to puppet=3.7.0.29-1puppetlabs1 and
puppetmaster=3.7.0.29-1puppetlabs1 fails. I believe this problem is due
to how Debian chose to package puppet-common, which owns
`/usr/share/man/man8/puppet-master.8.gz`.

This commit adds in a `Conflicts:` to the puppetmaster and
puppetmaster-common packages to make sure that we can successfully
upgrade from these older package versions. However, if a user has
puppetmaster and puppet older than 3.3.0 installed on a machine, and
only upgrades puppetmaster, this will uninstall the puppet package from
the system.
(maint) Remove GC bug workaround for Ruby < 1.8.7

Commit bd5dc649 added a workaround for a Ruby GC bug that was present in
1.8.5, 1.8.6, and partially fixed but still residual in 1.8.7. Since
we're dropping Ruby 1.8 support entirely we can now remove the
workarounds.
(PUP-1106) Unschedule refreshes on skipped resources

If a given resource is being skipped (e.g. has failed dependencies, is
unscheduled, untagged, etc) that resource should not trigger any
additional behavior. However a resource could be skipped and still have
events trigger behavior. This commit changes the event processing logic
to only process events for resources that should be applied and dequeues
events on resources that should not be applied.
(maint) Use correct data type when unscheduling events

Commit 9d59f204 added the ability to dequeue events on a given resource,
but it did so by setting the value of the target callbacks to an empty
hash. However the value of target callbacks is an array, so if events
were re-queued for a given resource we would get an error like so:

    {}.concat(%w{one two three})
    NoMethodError: undefined method `concat' for {}:Hash

Currently we can't requeue events after dequeuing events, but if this
changes then this code is very incorrect.

This commit fixes the event reset to behave as expected.
(maint) Ensure config acceptance resets uid

Now that we are testing puppet packages with service scripts, the puppet
master defaults to running, and we cannot adjust the puppet user uid
while that user is associated with a runing process. This acceptance
test was stopping the puppet master to remove the system puppet
user/group, but was failing to stop the puppet master when restoring the
system user group, resulting in the puppet system user retaining it's
new uid, and some files (particularly in ssldir) being owned by the old
uid.  This would potentially cause failures depending on test order.

This commit fixes the puppet_manages_own_configuration_in_robust_manner
test to stop the puppet master and restore the original user uid.
(maint) Remove the resource/host/should_query test

This test was attempting to verify that the host provider will show an
entry as present in a target host file.  But in fact, because Puppet has
just the single resource representing a host entry of the given name,
what this test is doing is ensuring that the 'localhost' host entry is
found in the given target file. On vms with two localhost entries (say
127.0.0.1 and ::1) this ends up moving the ::1 entry to the target file,
and the system continues to work. But on a system with a single
localhost entry in its /etc/hosts, this ends up moving that to the
target tmp file and crippling localhost name resolution for subsequent
tests. See PUP-1479 for more info.
(PUP-3248) Fix PMT tests for directory environment

The beaker host['distmoduledir'] variable is not meaningful if the
host is using directory environments (e.g. 'production').

This commit updates the helper methods for validating that a module
is (or is not) installed on the host by iterating over the
modulepath if a specific modulepath is not provided.

The calls to these helper methods have been updated for the change
in parameter ordering in the helper methods.
(PUP-3010) Allow Upstart jobs on Amazon Linux
(maint) remove commented out code (self.to_s)

to_s is implemented properly hundred lines down this file.  this code
has been commented out for quite some time.
time to get rid of it. if we need it back, we have version control.
Merge pull request #3105 from igalic/patch-1

remove commented out code (self.to_s)
Merge pull request #3106 from jpartlow/maint/stable/ec2-centos6-acceptance-fixes

Maint/stable/ec2 centos6 acceptance fixes
(maint) Fix unit of profile output

The profile aggregation stated that the times were in milliseconds (ms),
but they are actually in seconds (s).
(PUP-3248) Use tmpdir for generating environments

This commit changes calls to the
generate_base_legacy_and_directory_environments helper to use a
tmpdir rather than master['puppetpath'] to isolate the test
environments and prevent collisions.

The generate_base_legacy_and_directory_environments has also been
altered to remove the `environmentpath` setting in the generated
configuration file.
Merge pull request #3109 from johnduarte/pmt_directory_env_support

(PUP-3248) Fix PMT tests for directory environment
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (PUP-3248) Use tmpdir for generating environments
  (PUP-3248) Fix PMT tests for directory environment
  (maint) Remove the resource/host/should_query test
  (maint) Ensure config acceptance resets uid
(PUP-3322) Add debugging to appdmg provider

I was trying to install Scratch[1] using boxen[2]. The appdmg isn’t in
the expected format, so this failed. I had to poke around a bit to
understand why that was happening. This change captures that knowledge.

[1] http://scratch.mit.edu/scratch_1.4/
[2] https://boxen.github.com/
(PUP-3281) Remove latest_info methods from yum provider

This commit removes the deprecated #latest_info and #latest_info=
methods from the yum provider.

This commit is part of the Puppet 4 code removal effort.