(PUP-3258) node exec indirector: default to environment, not its name

Nodes can be classified through a local executable that prints YAML with
a node specification. This is enabled through the node_terminus=exec option.
Since PUP-2519, this setting would break `puppet apply`. Trying to apply
any manifest would lead to Puppet applying the default environment's site
manifest instead.

The reason for this is that the node terminus will include the current
environment's name in the node lookup result. This in turn makes Puppet
look up the environment per name. This is not the desired behavior, because
Application::Apply performs the lookup and further operations with a localized
environment that overrides the site manifest.

Solved by including the current environment object in the returned node object
instead of its name.
(maint) reduce repitition in Application::Apply integration spec
(PUP-2350) Disallow non-string file modes

In Puppet 4.0 integers will be parsed more strictly, which means that
file modes like `644` will be octal 1204. The alternative to this is to
force file modes to be strings where they cannot be interpreted
incorrectly. PUP-2349 deprecated non-string modes; this commit removes
support for them entirely.
(docs) Move user-facing docs for reinstall_on_refresh into user-facing doc string

These docs, intended for users, were in a comment where only developers would
ever see them. This commit moves them into place so they'll appear in the type
reference, and restores the original developer-facing comment for the parameter.
(PUP-3277) Fix acceptance Gemfile logic for choosing gemsource

Since there were no parentheses around the trinary, if GEM_SOURCE was
set, it would be immediately ||'d with OUTSIDE_PUPPETLABS, causing
rubygems.org to be selected as the path instead of GEM_SOURCE.  Broke
this bad logic up to make it explicit that GEM_SOURCE takes precedence,
and we only worry about a default if it is not set, then choosing
between two options based on whether the user has set the
OUTSIDE_PUPPETLABS flag.
Merge branch 'issue/master/pup-3277-fix-gemfile'
(PUP-3277) Fix two acceptance tests

The changes brought in for PUP-3277 were tested with PE, but running
them in our CI brought up several issues, one of which due to the Beaker
create_tmpdir_for_user method not working on windows, and the other
surfacing in use_enc_environment_for_files because directory
environments do not pick up module file changes and the test was
assuming it could change the module manifest on the master and have it
picked up by different agent runs.

Switched to manually chowning the tmpdir with a puppet apply for the
first problem, and setting environment_timeout to 0 for the latter.
Merge pull request #3149 from nfagerlund/docs_package_reinstall

(docs) Move user-facing docs for reinstall_on_refresh into user-facing doc string
(PUP-3277) Remove stray debugging line from lib_dir_hook test

This curl was just being used to trace environments when changing this
test, and was accidentally left in. Removing now. Sigh.
(PUP-3277) Fix numeric modes in acceptance tests

Unquoted non-octal numeric modes get mangled when the future parser is
being used. There were five tests that had manifests added to set up a
directory environment where the modes were unquoted, and they were
failing when the future parser was enabled because of bad permissions.
This commit fixes that. Sigh2.
(PUP-3277) Quote numeric modes in acceptance manifests

Fixes some other instances of unquoted octal modes in acceptance tests
manifests, which, while not failing, were still raising deprecation
warnings.
(PUP-3277) Add dir env to file/source_attribute test

This commit modifies the file/source_attribute test to use
directory environments.
(PUP-3277) Make whitespace consistent in file/source_attribute test

Only indent in blocks; step() calls without blocks.
Merge branch 'pup-3277-file-source-attribute'

* pup-3277-file-source-attribute:
  (PUP-3277) Make whitespace consistent in file/source_attribute test
  (PUP-3277) Add dir env to file/source_attribute test
(maint) Remove duplicate file handling code

The tests had their own way of creating files and directories for
testing. All of these different ways of creating files and directories
already existed in PuppetSpec::Files. This unifies them.
Merge branch 'pr/3144' into stable

* pr/3144:
  (maint) Remove duplicate file handling code
  (maint) reduce repitition in Application::Apply integration spec
  (PUP-3258) node exec indirector: default to environment, not its name

Closes GH-3144
Merge pull request #3148 from adrienthebo/removal/master/pup-2350-remove-non-string-file-modes

(PUP-2350) Disallow non-string file modes
(PUP-3306) Remove deprecated Puppet::SSL::Inventory#serial method

This commit removes the deprecated `serial` method from the
Puppet::SSL::Inventory class. It is replaced by
Puppet::SSL::Inventory#serials.

This commit is part of the Puppet 4 code removal effort.
Merge pull request #3153 from whopper/pup-3306/remove_serial_method

(PUP-3306) Remove deprecated Puppet::SSL::Inventory#serial method
(PUP-3239) Refactor node environment validation

Prior to this, the compiler was responsible for testing the environment
and producing an error message.  This change pulls the validation step
into node environment, breaking the error message up so that any
component can check if an environment has setting conflicts and return a
uniform error message.  This will make it easier to add other
environment checks.

We refrained from including a more general error message handling
mechanism similar to what is currently in POPS because generalizing that
is a bigger task more suited to a broader internationalization epic.