(#2157) Make facts_dot_d compatible with external facts

Since facts_dot_d will eventually be removed and replaced by
external facts, warn users who are using a ttl on their external
facts that this feature will not be in Facter external facts.

Provide a link to a page explaining how to cache fact values
without the ttl functionality.
Merge pull request #77 from hkenney/ticket/2.4.x/2157_add_external_fact_compatibility

(#2157) Make facts_dot_d compatible with external facts
Use rvalue functions correctly

A bug fix in Puppet exposed that several tests were using rvalue functions
incorrectly (this was not properly checked by puppet before). This fixes those
tests.
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Use rvalue functions correctly
Make sure functions are loaded for each test

The test_helper code in Puppet now resets function state between each test.
This patch fixes two spec files where the function was not actually loaded in
the tests, causing them to fail.
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  Make sure functions are loaded for each test
  Use rvalue functions correctly
  (Maint) Don't mock with mocha
  (Maint) Fix up the get_module_path parser function
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope (2.3.x)
  (Maint) Rename PuppetlabsSpec::Puppet{Seams,Internals}
  (Maint) use PuppetlabsSpec::PuppetSeams.parser_scope
  (Maint) Fix interpreter lines
  Update CHANGELOG, Modulefile for 2.3.3
  fix regression in #11017 properly
  Fix spec tests using the new spec_helper
  Update CHANGELOG for 2.3.2 release
  Make file_line default to ensure => present
  Memoize file_line spec instance variables
  Fix spec tests using the new spec_helper
  Revert "Merge remote-tracking branch 'eshamow/tickets/bug/13595_restrict_initialize_everything_for_tests' into 2.2.x"
  (#13595) initialize_everything_for_tests couples modules Puppet ver
Merge branch '2.4.x'

* 2.4.x:
  Make sure functions are loaded for each test
  Use rvalue functions correctly
  (#2157) Make facts_dot_d compatible with external facts

Conflicts:
	lib/facter/facter_dot_d.rb
Disable tests that fail on 2.6.x due to #15912

In Puppet 2.6.x there is a bug where a function may be incorrectly detected as
an rvalue when it is not, or not detected when it is. This means that in tests
the correct syntax for calling a function will be rejected. This disables
those tests on 2.6.x, as there is no straightforward way to write them to be
compatible with both 2.6.x and newer versions of Puppet.
Merge branch '2.2.x' into 2.3.x

* 2.2.x:
  Disable tests that fail on 2.6.x due to #15912
Merge branch '2.3.x' into 2.4.x

* 2.3.x:
  Disable tests that fail on 2.6.x due to #15912
(Maint) use PuppetlabsSpec::PuppetInternals.scope (master)

This patch is the same approach as the one that want into 2.3.x.  It
covers the functions in master that do not exist in 2.3.x.

Without this patch all of the spec tests for parser functions in stdlib
would instantiate their own scope instances.  This is a problem because
the standard library is tightly coupled with the internal behavior of
Puppet.  Tight coupling like this creates failures when we change the
internal behavior of Puppet.  This is exactly what happened recently
when we changed the method signature for the initializer of
Puppet::Parser::Scope instances.

This patch fixes the problem by creating scope instances using the
puppet labs spec helper.  The specific method that provides scope
instances in Puppet-version-independent way is something like this:

    let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

This patch simply implements this across the board.

Paired-with: Andrew Parker <andy@puppetlabs.com>
Merge branch '2.4.x'

* 2.4.x:
  (Maint) use PuppetlabsSpec::PuppetInternals.scope (master)
  Disable tests that fail on 2.6.x due to #15912
Add function ensure_resource and defined_with_params

This commit adds 2 new functions with unit tests.

defined_with_params works similarily to puppet's defined
function, except it allows you to also specify a hash of
params. defined_with_params will return true if a resource
also exists that matches the specified type/title (just like
with defined) as well as all of the specified params.

ensure_resource is a function that basically combines defined_with_params
with create_resources to conditionally create resources only if the
specified resource (title, type, params) does not already exist.

These functions are created to serve as an alternative to using
defined as follows:

    if ! defined(Package['some_package']) {
      package { 'some_package': ensure => present,
    }

The issue with this usage is that there is no guarentee about
what parameters were set in the previous definition of the package
that made its way into the catalog.

ensure_resource could be used instead, as:

    ensure_resource('package', 'some_package', { 'ensure' => 'present' })

This will creat the package resources only if another resource does
not exist with the specified parameters.
Handle undef for parameter argument

This commit adds better handling of the case where
undef is passed as the parameter value.

This works by converting '' into []
Add better docs about duplicate resource failures

This commit adds better inline documentation
explaining how replicate resource definitions can
occur if the resource exists and does not have
matching parameters.
re-formatting

This commit refactors to ensure 80 character lines.
(#15872) Add to_bytes function

Converts a string like "2 MB" to the value in bytes. Useful for
comparisons on facts that return a human readable number instead of
machine readable.
Merge branch 'feature/2.4.x/to_bytes_function' into 2.4.x

* feature/2.4.x/to_bytes_function:
  (#15872) Add to_bytes function
Merge branch '2.4.x'

* 2.4.x:
  (#15872) Add to_bytes function
Add support for a 'match' parameter to file_line

This commit adds a new parameter called "match"
to the file_line resource type, and support for
this new parameter to the corresponding ruby
provider.

This parameter is optional; file_line should work
just as before if you do not specify this parameter...
so this change should be backwards-compatible.

If you do specify the parameter, it is treated
as a regular expression that should be used when
looking through the file for a line.  This allows
you to do things like find a line that begins with
a certain prefix (e.g., "foo=.*"), and *replace*
the existing line with the line you specify in your
"line" parameter.  Without this capability, if you
already had a line "foo=bar" in your file and your
"line" parameter was set to "foo=baz", you'd end up
with *both* lines in the final file.  In many cases
this is undesirable.