(#14123) Puppet shouldn't explode if PATH contains ~nonexistent_user

As reported in http://bugs.debian.org/669650, when the PATH contained an
expansion for a user that doesn't exist, Puppet handled it the same way Ruby
does - to raise an exception, and explode.

Leaving aside the sanity of literal tilde in the PATH, we shouldn't explode in
that case - we should just skip that entry and carry on to the next element in
the path instead.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
(#14127) ssh_authorized_keys grammer fails on blank lines.

The `ssh_authorized_keys` grammer, defined for ParsedFile, is wrong about both
comments and blank lines.  Specifically, it failed in two key ways:

It failed if a comment didn't start on character one; any whitespace caused
the comment to be ignored, which is absolutely incorrect by the official
OpenSSH implementation.

It also failed because a "blank" line was defined as a line that contained one
or more whitespace characters at the start - and nothing more!

This failed in a bunch of ways, starting with assuming that a comment on a
line with leading whitespace was actually a blank line.

This change fixes both of those bugs, as well as adding appropriate tests.

(See `rsa_key_allowed_in_file` in `auth-rsa.c` for the parser, at least in the
 current as of this commit version of OpenSSH.  That is official enough for me
 to assume that everyone will behave that way ;)

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
maint: refactor integration specs for ssh_authorized_key

Replace all before blocks and instance variables with rspec let methods
and move the stubbing of File.chmod that happened in all tests to the
top to reduce code duplication.
(#14127) Add integration tests for ssh_authorized_key

Test the behaviour of the ssh_authorized key type when modifying a file
with different kind of text lines (inline comment and blank lines)
(#14173) Enforce that filebucket paths must be absolute

If you passed the filebucket a relative path, perhaps by accidentally quoting
'false', it would happily accept that and create a directory relative to the
current working directory to store content in.

This enforces that the path must be absolute, as well as failing cleanly if
multiple paths are passed.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
Properly call indirector when storing file content

Prior to this commit, the static compiler did not specify to use
indirection when finding file content nor when saving a file to the
filebucket.  This commit properly calls the indirection method to
resolve the issue
(#8235) Add plug-in system for tools like Hiera

A new data_binding indirection is being added for interfacing with
tools like Hiera; and provides an "in-dsl" solution for data separation.
Data exposed by tools like Hiera will be made available during parse
time.

For example, if we had the follow class definition:

    class nginx($port=80) { ... }

And it was declared without specifying the `port` attribute:

    class {'nginx': }

The above would result in a data lookup to the data_binding backend for
the following namespaced key:

    nginx::port

Namespaced keys are being used to prevent the pollution of the global
namespace. The convention for namespaced keys is a combination of the
class name and the class parameter being resolved.

Example:

    class ssh::server($port) { ... } # Lookup ssh::server::port

The data_binding backend would need to provide a value for the
namespaced key or return nil. When a nil value is returned by the
data_binding backend the class parameter default, if available, will be
used instead.

It should be noted that class parameters are looked up one at a time
with no assumptions in regards to the performance of data lookups. It's
the responsibility of the data_binding backend to handle any performance
requirements including caching.

This patch also adds two new terminii: hiera and none. The "none"
terminus implements a find method that always returns nil; it's being
set as the default data_binding terminus to allow end-users the ability
to opt-in and maintain backwards compatibility with older versions of
Puppet.

The "hiera" terminus implements a find method that delegates class
parameter lookups to Hiera using the Hiera Ruby API.

Two new configuration settings are being added:

    [main]
      hiera_config = "$confdir/hiera.yaml"
      data_binding_terminus = "none"

Updated specs are included in this patch
(#8778) Make '' == undef commutative in the DSL

Without this patch applied the Puppet DSL treats undef == '' as true
but '' == undef as false.  This is undesirable because the equality
operator should be commutative.

This patch fixes the problem by adding an explicit check for '' == undef
in the AST.  Without this patch applied, Puppet already has an explicit
check for undef == '' but not for '' == undef.

The spec tests are also updated by this patch to reflect the change.
Merge branch 'ticket/2.7.x/8778_equality_in_puppet_is_not_commutative' into 2.7.x

* ticket/2.7.x/8778_equality_in_puppet_is_not_commutative:
  (#8778) Make '' == undef commutative in the DSL

Reviewed-by: James Turnbull
Munge settings in value instead of set_value

Before this munging happened before variable interpolation in settings. This
made it impossible to expand a path properly if it contained a reference to
another setting. By munging after variable interpolation we can solve this
problem.
(#14229) Add a path type to settings

This path type will expand all paths in a string separated by
File::PATH_SEPARATOR, but does not add the paths to the settings catalog. This
helps the most on Windows, where it means that paths given to settings will
consistently use File::SEPARATOR, no matter how they were entered by the user.
Remove type hack from file settings

File settings could be files or directories based on whether the setting name
contained 'dir' or if the value ended in a slash. We now have a distinct
directory type and this is no longer necessary.
Use expand_path to normalize paths in autoloader

Just using Pathname#cleanpath didn't properly convert \ to / on windows. Using
both should give correct normalized paths. This also cleans up the specs to
work better with Windows paths, as problems there were revealed by this
change.
Merge pull request #713 from daniel-pittman/bug/2.7.x/14173-filebucket-resource-should-validate-path

(#14173) Enforce that filebucket paths must be absolute
Merge pull request #700 from daniel-pittman/bug/2.7.x/14123-don't-explode-when-path-has-bad-content

Bug/2.7.x/14123 don't explode when path has bad content
Fix filebucket specs on Windows
Fix incorrect argument handling for expire in NodeExpirer

Since it takes an optional key it needs to use that key if it exists. This
also resolves an error `undefined method 'name' for #<Hash...` that could
occur when posting facts over REST if the yaml didn't have a proper name
variable. This will still fail, but at a point that gives a much better error
message.
Fix #14123 for Windows

Windows raised a different exception when a home directory doesn't exist, so
we catch that too.
Merge pull request #729 from pcarlisle/baduser-windows

Fix for ignoring nonexistent home dirs on Windows
Merge pull request #706 from pcarlisle/autoloader-windows

Use expand_path to normalize paths in autoloader