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.
Documenting missing --noop option for puppet apply
Merge remote-tracking branch 'origin/2.6.x' into 2.7.x

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Merge remote-tracking branch 'origin/2.7rc' into 2.7.x
Merge remote-tracking branch 'origin/2.7.x'

Conflicts:
	spec/unit/parser/functions/create_resources_spec.rb
	spec/unit/resource_spec.rb

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Provide a helpful error message when name resolution fails

Previously, this would print a message like:

getaddrinfo: nodename nor servname not provided, or not found

Which is opaque to anyone who doesn't already know what it means. This is a
very common case (it happens, for instance, when first starting a default agent
without setting up a DNS entry for 'puppet'). Now, we catch SocketError when
making an HTTP request, and print a more useful error message if this is the
particular failure case.
Merge pull request #573 from nicklewis/helpful-name-resolution-failure-message

Provide a helpful error message when name resolution fails
Update packaging spec files for 2.7.12
Update CHANGELOG for 2.7.12
Merge branch '2.7rc' into 2.7.x
Revert "Provide a helpful error message when name resolution fails"

This reverts commit aae3a58b7d241b33b7a12ff2aadafa2db3b4904d.