(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) Log invalid modules

Give notice when a module on the modulepath is invalid, explaining why.
To do this cleanly, we stop trying to add "." and ".." as modules since
these are always invalid.
(maint) Avoid checking for strings in module_references

module_references contains Hashes so there is no need to look for
strings within it, especially when the next line does what this one was
supposed to do.
(PUP-3511) refactor Application.run for reuse

Extract a small chunk of code from Puppet::Application.run into its own
method so that it can be reused.  This code is currently duplicated in
Puppet Server; the introduction of this new `reset_environment_context`
method enables the replacement of the duplicated code in Puppet Server
with a call to this method.
(PUP-3511) refactor 'configure_indirector_routes'

Add a `self` version of `configure_indirector_routes` which takes the
application name as a parameter.  This method is currently copied into
Puppet Server, and the new version of it will allow for the duplicated
version in Puppet Server to be deleted.
(PUP-3511) introduce 'ApplicationSupport' module

Introduce a new module named 'ApplicationSupport'.  Move
'configure_indirector_routes' into this module.  Move
'reset_environment_context' into this module, and rename it to
'push_application_context'.
(PUP-3511) yardoc for 'push_application_context'
(PUP-3654) Deprecate Puppet.newtype

The `newtype` class method of the Puppet module includes a comment from
2011 stating that the method should be deprecated, but was under heavy
use at the time.

This commit adds a deprecation warning to this method to indicate that
it will be removed in a future release. Types using the old method have
also been updated to use `Puppet::Type.newtype`.
(PUP-3511) update docs in 'ApplicationSupport'
(PUP-3665) Fix resource overrides for 4x collector

Prior to this commit, the new implementation of collections caused
overrides to fail if the given attribute was a Resource. This was
because 3x required an instance of Resource rather than PResource
Type. In order to fix this issue, transform the override attribute
into the appropriate format for the 3x compiler.
Merge pull request #3307 from hkenney/issue/stable/PUP-3665_fix_collection_resource_overrides_with_future_parser

(PUP-3665) Fix resource overrides for 4x collector
(PUP-3096) Remove deprecated trusted_node_data and immutable_node_data options

This commit removes the deprecated trusted_node_data and
immutable_node_data options from puppet/defaults. This ensures
that $facts and $trusted are always available so that we can
start phasing out facts as top-scope variables.

This commit is part of the Puppet 4 code removal effort.
(maint) Verify module exception is logged

Verifies that if puppet fails to load a module, e.g. missing metadata,
that we log the exception:

     $ bundle exec puppet apply -e "include mymodule"
     Error: No dependencies module metadata provided for mymodule
     Error: Could not find class mymodule for ...
(maint) Refactor tests to use helper to create module directory

Refactor tests to use PuppetSpec::Modules.generate_files to create
the module directory. Note the order of arguments is reversed.
Merge branch 'pr/3261'

* pr/3261:
  (maint) Refactor tests to use helper to create module directory
  (maint) Verify module exception is logged
  (maint) Avoid checking for strings in module_references
  (maint) Log invalid modules
(PUP-3512) Remove the old Profiler profile API

Remove the old Profiler profile API, which supported calls to
profile without a metric ID. Remove tests that ensured the
old API worked.
Merge branch 'stable'
Merge pull request #3308 from fpringvaldsen/PUP-3512-profiler-deprecation

(PUP-3512) Remove the old Profiler profile API
Merge pull request #3298 from KevinCorcoran/PUP-3511/introduce-method-for-reuse

(PUP-3511) refactor Application.run for reuse