(#3910) Add acceptance test for case of enc that doesn't specify environment
(#3910) Use the requested environment of node as default in exec terminus

A request has an environment, and if the ENC doesn't override it we should use
the environment in the request.  This also means that we have to pass along
the request environment when the compiler terminus requests a node.
Rename dostorage to init_storage
Refactor removing prepare in configurer

These things don't belong together anymore.
Clean up the exec indirection terminus

Slight refactor to make the code a little cleaner.
(#3910) Query node before fetching catalog to determine environment

This makes the agent query for its node before getting a catalog so that it
can determine the correct environment from that node. This allows an ENC to
override the agent's environment without incurring an extra catalog
compilation.

It also sets the default node terminus to rest in the agent application.
(#3910) Set environment locally in configurer

We have been using Puppet[:environment] as global state, when it should just
represent the initial configuration. This is a first step to changing that.
(#3910) Thread environment through plugin downloader

The plugin downloader now takes an environment argument, which it uses to
fetch plugins for the correct environment.
(#3910) Give environment in indirection calls in configurer

In order to make sure we handle the (no longer global) environment correctly
when setting up an agent run, pass the environment as an option to all
indirection calls that the configurer makes.
(#3910) Use catalog's environment when fetching file content

This ensures that file content is fetched from the correct environment. Before
this it was possible to have the metadata from one environment and content
from another.
Make positional arguments distinct in Request#initialize

Puppet::Indirector::Request#initialize had a weird implementation giving
variable semantics to positional arguments. This makes it normal again.
(#3910) Give environment as argument to indirection requests

This threads the environment option through more indirection requests to
ensure everything happens against the correct environment.
(#3910) Default to no cache for nodes on master

The default cache terminus for nodes on the puppet master was yaml. If you are
using an ENC, there is no decent way to invalidate this cache. It does not
seem useful or necessary (the master only queries the node once per agent
check-in) so we're leaving it off by default.
Fix file path used in enc acceptance test
(#3910) Add nodes to auth.conf in acceptance tests
Merge branch 'pcarlisle-ticket/master/3910-updates'

This reflects pull request #691, but is being done by hand because the changes
in this code reveal the weak stubbing performed in other agent tests.
Fix over-stubbing in tests revealed by agent changes.

Various tests of the agent stubbed `File.read` globally, which means that they
could pass if and only if there was only one read ever made by the agent in
the execution of "apply".

This was, in fact, true until recent changes to ensure the ENC could correctly
override the environment that the agent ran in - which, in turn, reveals the
coupling of these tests to the implementation.

This corrects those tests by using a real temporary file rather than stubbing
out all file reads in a shot.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>