(PUP-3302) Fix resource when using directory environments

Before this fix when `puppet resource file` was being used set with
source defined puppet would error out because we need an environment
object in Puppet::Indirector::Request#environment= and instead of the
none environment being passed around it is passed as the string "none"
which is a directory environment that does not exist. This is what is
raising the EnvironmentNotFound error in puppet.

Instead of passing around a string we pass around the none environment
to fix the issue.
(PUP-3302) Fix Puppet Resource

@jpartlow and I paired on this issue.
Before this commit when using puppet resource with any resource that
went through the ral and needed a real environment would fail since the
default behaviour of Puppet::Resource::Catalog#initialize was to create
a new catalog used the None environment. In places where we were
performing `Puppet.lookup(:environments).get` on the None environment
puppet would fail, causing the none environment not found error to be
raised.

This commit changes the default behavior of Puppet::Resource::Ral#save
to create a catalog with the `current_environment` that is setup at
application initialization instead of the none environment. It also
makes `default_file_terminus` set to `file_server` in
`Puppet::Application::Resource` to make `puppet resource` act like
`puppet apply`.

We wanted to make sure that this change was not going to harm any other
parts of the puppet codebase and at least in puppet the ral is only used
when using `puppet resource`. We do not believe that it will have any
adverse effects anywhere else.
(PUP-3514) Fix broken errors from future parser

When the future parser called the error method from within the parser
(the few remaining cases handled by the parser directly), that resulted
in the Factory being called to produce new expressions and these were
subsequently turned into strings - showing a series of (slice ...)
s-expression.

The error method was simply doing the wrong thing (copied from the 3x
parser). This commit fixes the problem by picking up as much as possible
of the known location and passing that along in the exception that is
raised.

One test is included to ensure we do not have regressions on this
behavior. The remaining error cases are still untested, but the
intention is for those to be moved out from the grammar and into
validation to improve the ability to give better error messages.

This commit only fixes the immediate problem of getting garbage output
instead of file, line and position in these cases.
(PUP-3514) Fix test stylistic issues, remove unused parameter

This removes the unused parameter options in parser_support's 
error method.

The style of the tests for errors raised from the parser
has been changed to use expect(x).to ... to get better error messages
if test fails.
(PUP-3558) Fix offset error of '[' lexing when multibyte chars are used

If there were multibyte characters anywhere before a '[' and the '['
should have been lexed as a LBRACK the difference in byte position and
char position could result in looking at the wrong position for the
character preceding the '['. If that character (wrong position) was
a whitespace, the lexer would emit a LISTSTART token instead of LBRACK.

The correct way to translate byte offset to char offset is to
use the locator.char_offset(byte_offset) method (since the method varies
depending on Ruby version).

If jupiter aligned with mars the result could be a syntax error on the
'[' because a literal list was not accepted in that position, or worse,
an access expression (x[y]), could be broken apart into two expressions;
a value followed by a literal list. The latter could go unnoticed except
for not producing the wanted answer.

This commit changes the method to get the char offset to use the locator
instead of using the byte offset as a char index when looking at the
preceding character of a '['.
(PUP-3277) Set selinux context for new acceptance test environments

The acceptance environment_utils currently backup existing $confdir
files and copy in test environment files created in /tmp.  These test
files may have a different selinux context than $confdir, which can
result in agent -t runs coming back with selinux context changes and an
unexpected exit code of 2. Rather than just assume that all agent runs
may have resource changes, the helper instead sets $confdir's context
for the test files once they have been copied in (if selinux is
enabled).
(Maint) Invert conditional to make it clearer

The behavior of environment bootstrapping is handled differently for
agent vs non-agent. The code that handled this expressed it as `run_mode
!= agent`, which became a little hard to parse when reading it. By
inverting the conditional it becomes a little easier to determine what
code path will be taken.
(Maint) Restore non-local behavior for resource

The puppet resource subcommand used to work with a remote file server
(`:rest`), a previous change made it behave more like puppet apply,
which uses a local file server. That wasn't a request from users, and it
isn't clear if it is actually the correct behavior. Normally it is used
for introspecting resources locally and so a local file server might
make sense. OTOH, remote is the behavior is has had for a very long
time...
(PUP-3302) Ensure resource uses given environment

Before this commit when puppet created the catalog in
`Puppet::Resource::Ral#save` with the current_environment instead of the
environment that the request passed into the indirector had requested.

This commit also modifies existing spec tests to show the cases where
the behavior that the commits in this pull request had fixed regarding
puppet resource.

Paired with @zaphod42
(PUP-3302) Remove redundant spec test

The integration test that specifically tried to cover recursion for the
file type was no longer needed. We could get similar coverage by simply
tightening up the evaluation environment in
spec/integration/type/file_spec.rb to not have any environments
available, which caused the code under test to show the mistake.
Merge pull request #3198 from demophoon/fix/stable/pup-3302-puppet-resource-directory-environments

(PUP-3302) Puppet resource fails when using directory environments
Merge pull request #3233 from hlindberg/PUP-3514_future_parser_errors_from_parser

(PUP-3514) Fix broken errors from future parser
Merge pull request #3250 from hlindberg/PUP-3558_non-ascii-chars-breaks-liststart-check

(PUP-3558) Fix offset error of '[' lexing when multibyte chars are used
(PUP-3593) Ensure puppet-server is stopped before cleaning certs.

This will prevent cert cleaning from happening while puppet-server is still
starting up, for example when one of the last actions by the previous test case
was to restart the master.
(PUP-3555) Override-able cache expiration service

This commit introduces an override-able cache
expiration service for directory environment cache
entries.  A caller may provide a custom implementation
of the expiration service, and it will receive
callbacks whenever a cache entry is created,
checked for expiration, or evicted.
Merge pull request #3260 from cprice404/feature/master/PUP-3555-cache-expiration-service

(PUP-3555) Override-able cache expiration service
Merge pull request #3258 from waynr/quickfix

(PUP-3593) Address SSL cleanup and puppetserver restart timing issues in acceptance tests.
(PUP-3471) Don't clobber variables in system path

Bumps puppet_for_the_win dependency for PUP-3471.
(PUP-3601) Adjust Facter dependency for Windows

This moves the Facter dependency to 2.3.0 since it was just released and should
be released with the next version of the Puppet MSI that we ship (3.7.3).
Merge pull request #3262 from ferventcoder/ticket/stable/PUP-3601-update-facter-for-windows

(PUP-3601) Adjust Facter dependency for Windows