(#12960) Fix puppet resource <type> if type has no providers

puppet resource type calls the instances method of the type class. The
instances method then calls providers_by_source which can fail if the
following conditions are true

    1) there is at least one provider defined for the type
    2) all providers are unsuitable

If both requirements are met, the method self.defaultprovider will
return nil and we get the following error message (provided by Ben Ford)

    # puppet resource maillist
    puppet/type.rb:902:in `providers_by_source': undefined method `source'
    for nil:NilClass (NoMethodError)

The fix handles the case where defaultprovider can be nil
Fix order dependent spec failure caused by formats_spec

This was adding a feature for pson inside of a block that already depended on
the pson feature. This seems unnecessary.
Merge pull request #560 from stschulte/ticket/2.7.x/7986

(#7986) Modify pkg provider to handle publisher
Fix hash comparison under RSpec with 1.8.5

The behaviour of eql isn't quite right, and == actually does the right check,
on all versions of Ruby / RSpec.  This accepts that, and stops using eql in
rspec checks.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #566 from daniel-pittman/maint/2.7.x/fix-pkg-provider-tests-on-1.8.5

Maint/2.7.x/fix pkg provider tests on 1.8.5
missing: )
Merge pull request #567 from Erkan-Yilmaz/master

add missing )
Merge pull request #562 from stschulte/ticket/2.7.x/12960

(#12960) Fix puppet resource <type> if type has no providers
Merge pull request #522 from domcleal/tickets/master/8011c

(#8011) Support temp repo URLs in pkgutil provider
Merge pull request #545 from pcarlisle/ticket/master/12891-reload-features

(#12891) Make features reloadable
Merge pull request #565 from lotheac/fix_subcommand_exit_status

(#12981) Fix external subcommand exit status
Document the problem with the `apply_to_device` and related methods.

These methods were introduced, producing a pale shadow of the constraint
system that we already had, as part of building out device support.

Now that we are confident of the long term value of that support, and are
looking to better integrate it, we should start cleaning up these older relics
of the initial design.

This flags, in a comment, what the problem is and what the solution should be,
so that folks looking at the code get directed to the right sort of place.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Clean up "foo" name in global resource state.

Expecting that a type by the name of "foo" doesn't exist is asking for
trouble, because other tests are highly likely to create one.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Clean up the "foo" name in create_resources_spec.

Using a common meta-name like "foo" in testing runs a risk that global state
will lead down the path to things going wrong.  In this case, it clashed
with a type created elsewhere that lingered...

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Finally, stop using the `foo` name in the type_spec test.

Using a common name like `foo` runs the risk that things go terribly wrong;
better to use something less likely to conflict.  Now we expunged the other
places this broke, this is safe to do.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge pull request #568 from daniel-pittman/maint/2.7.x/12960-fix-order-dependent-test-failures-over-global-state

(#12960) fix order dependent test failures over global state
(#3910) Include environment in catalog

This adds an environment field to a catalog, so that the puppet master can
tell agents what environment it used to compile the catalog and what it
expects them to use.
Remove unused clear method in configurer
(#3910) Make puppet agent use environment specified in catalog

If there is an environment specified in the catalog to be applied (i.e. an
external node classifier was used and gave an environment for this node) the
puppet agent will switch to that environment.

When switching environment, the agent needs to get facts and plugins again
using the new environment, and then try fetching the catalog again using the
new facts, since this may change the catalog. It loops in this process several
times, until the environment doesn't change. If it fails to stabilize in a
limited number of tries it will raise an error and abort the run.

This change also means that the prerun command runs after fetching catalog but before
applying. It previously ran before fetching the catalog.
(#3910) Acceptance tests for environments and ENC

Added acceptance tests around the setting of environments by an agent and an
ENC. Verify that pluginsync and filebucket requests use the correct
environment.