(PUP-1362) (PUP-1775) Use yum check-updates for latest yum packages

Early versions of the yum package provider used `yum list available` to
determine the latest version of packages that were `ensure => latest`.
However the versions of yum available around that time changed the
output formatting of yum, which meant that the parsing code would break
on a regular basis (#836).

Commit 8722e439 resolved this by using the yum python bindings to
interact with yum. This required shipping a python helper script to
provide the interface between Puppet and the python libraries. However
this opened up a host of other issues ranging from what version of
Python is symlinked to '/usr/bin/python', how the yum database is
locked, and so on (PUP-1362, #11380, #16623). In addition changes to
yumhelper.py were very hard to test or reason about since it doesn't
neatly plug into our existing tests.

This commit removes yumhelper.py and replaces the update checks by
calling `yum check-update`. The output format of this command has not
changed since CentOS 4 and works all the way up to RedHat 7 so we should
be able to rely on this for a while.
(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-3479) Update Windows ffi dependency to new ffi

Ruby 2.1.3 on Windows requires ffi 1.9.5. Update our Windows dependencies
to allow 1.9.5+ to be selected.
(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-2706) Change adduser to useradd in postinst

There has been an intermittent error where the installation of
puppet-common is failing on Ubtuntu 14.04. This error is
```
chage: the shadow password file is not present
/usr/bin/chage failed with return code 15, shadow not enabled, password aging cannot be set. Continuing.
chfn: PAM: Authentication failure
adduser: `/usr/bin/chfn -f Puppet configuration management daemon puppet' returned error code 1. Exiting.
```

Though `chage` is complaining about the fact that shadow is not enabled,
it looks like the installation is failing sure to the `adduser` call.
The thought is that `adduser` does some things under the hood that
require PAM to be configured in the build environment, which it isn't.
If we change the call from `adduser` to `useradd`, hopefully we will not
run into this issue. Note: it is difficult to test this due to the
intermittent nature of the issue.

Also, since we're removing the use of `adduser`, we no longer need to
ensure that package is available on the system.
(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-2716) Remove references to dead settings

Commit 30eb9834f introduced two settings, `ssl_client_ca_chain` and
`ssl_server_ca_chain`, which were referenced in code, but were commented
out in defaults.rb. As a result, the settings could never be set, and
always had a nil value.

Commit f99a759db removed the commented out settings from defaults.rb.

This commit removes references to the dead settings.
(PUP-2716) Deprecate ca_chain_file in documentation only

Since the ssl_{server|client}_ca_chain setting was never settable, the
Puppet::SSL::Configuration#ca_chain_file method is not meaningful, and
is deprecated.

This commit deprecates the method in documentation only.
(PUP-3553) Remove support for OSX versions <= 10.6
(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.
(maint) Remove extra agent from the debian init script

Previously when the debian puppet service was started, it would have
an extra agent in the name because we set both daemon_opts and name to
agent and pass both to the starting exec. This commit addresses that by
setting daemon_opts to be empty, it can be overridden in the defaults
file.
(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 '['.
(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.