maint: relax spec test of resources

The resource_spec performs some comparisons by using the equal_attributes_of
matcher. This is mostly correct, but considers some instance variables that are
of no consequence to the resource, e.g. @rstype. As a result, internal changes
to Puppet::Resource that may lead to this attribute not being set in a resource
that is generated from YAML would break this expectation:

expected
Foo::Bar[xyzzy]{:name=>"xyzzy", :one=>"test", :two=>"other"}
to equal attributes of
Foo::Bar[xyzzy]{:name=>"xyzzy", :one=>"test", :two=>"other"}

This is not only difficult to debug, it first and foremost misses the intention
of the example, which is only concerned with RAL attributes, not "internal"
instance variables.
(PUP-1381) issue warnings to current users of cron purging

A behavioral fix is planned for the 4.0 release. The final
3.x point releases should issue early warnings to users who employ
the functionality that is about to change.
(PUP-1381) make file_setting spec test more robust

A new call to self.resource_type in Puppet::Resource#initialize can cause
the loading of type code as a side effect. This interfered with the mocking
for the test

Puppet::Settings::FileSetting when being converted to a resource
should manage existent files even if 'create_files' is not enabled

Add a stubs call to one of the uncritical expectations so that
additional calls are not considered as spurious.
(PUP-1843) Restore hiera indirector terminus

This was collapsed into the DataBindings code in 9a5b81b412. That broke
community plugins using this code. This commit just restores the code
but doesn't revert the other changes from that commit.
(PUP-2298) add resource lifecycle method Puppet::Type#pre_run_check

In order to deprecate the builtin defined function (which is often abused
to work around resource duplication among modules) it is desirable to
add resource constraints to the language. An easy approach to allowing such
constraints to work is to add them as a special resource type that does not
take effect during the transaction, but fails the whole catalog in case of
validation failure.

To make this possible, add a new method #pre_run_check to the Type base class
for overriding in appropriate resource types (such as constraint).

The semantics is simply
- raise nothing if the pre-run check is succesful
- raise a Puppet::Error otherwise

The check is performed during evaluation of the transaction, just before
the catalog is applied. The generating of additional resources should be
complete when this is done (because the hook is meant to be able to
check the whole catalog for consistency).
(PUP-2298) protect transaction spec test against new exceptions

The new perform_pre_run_checks method in the transaction loops over
all resources in the catalog. This is prone to failures if any nil references
end up in the catalog. This can happen during the addition of resources
to the catalog under test conditions, because the mock resources are not
sufficiently contained.

To work around this effect, stub the very #container_of method in the mock
catalog so that all resources will have an apparent container.
(PUP-1807) Change empty string to be "truthy"

An empty string is now interpreted as a "true" value. It used to
represent a false value.

This representation is only in the future evaluator. Values are still
transformed when calling the 3x function API (it expect undef to be
encoded as empty string). This also takes place when transforming to the
3x catalog.
(PUP-1807) Add tests cases for undef equality checks

This adds checks that future evaluator treats '' != undef.
(It already did this, but tests were missing).
(maint) Remove commented out code
(PUP-2514) Remove ability to search for String type in String.

While philosophically true, a String consists of a number of
substrings, it is not very meaningful to support only the ability to
assert that. In order to be useful it would need to answer a much wider
variety is Enum[red, blue, green] in "it was blue, orange, and red", is
there a String of 1-5 characters in length inside the string "1234" etc.

This commit removes the naive support for String/Data-type search
in String as it is more confusing than helpful. If we later find it to
be of value, a more elaborate implementation is needed.
(PUP-2660) user: set the user should-value when generating ssh_authorized_keys

When purging authorized SSH keys, the user type generates ssh_authorized_keys
resources using eval_generate. The ensure property receives a should value of
"absent" so the keys are removed. However, those resources are non-functional
because the user property lacks a should value. The resource fails during
Provider::Ssh_authorized_keys::Parsed#flush.

Fixed by setting the appropriate user value for each generated key.
(PUP-1381) Add link to explanation of message

Our standard practice for deprecation messages is to provide a link that
can point to more information than the message can provide.
Merge branch 'pr/2492'

* pr/2492:
  (PUP-1381) Add link to explanation of message
  (PUP-1381) make file_setting spec test more robust
  (PUP-1381) issue warnings to current users of cron purging
  maint: relax spec test of resources
(PUP-1070) cleanup empty/invalid lockfiles

Currently lockfiles won't be cleaned up automatically if they're empty or contain
non numeric characters.

This commit solves this by verifying that the content of the lockfile
contains a number or otherwise return nil which will result in deleting
the pidfile.
Merge branch 'ticket/master/PUP-1070-cleanup-invalid-lockfiles'

* ticket/master/PUP-1070-cleanup-invalid-lockfiles:
  (PUP-1070) cleanup empty/invalid lockfiles
(PUP-1843) Refactor duplicate code

Puppet::Indirector::Hiera and Puppet::DataBinding::Hiera had
identical implementations.  Puppet::DataBinding::Hiera is now a subclass
of Puppet::Indirector::Hiera.  Common behavior in their specs was also
moved into spec/shared_behaviors.
(PUP-2298) Use resource specific log_exception

Previously, we were logging the exception using `Puppet.err` and
passing in the resource reference in the message.

This commit changes it to use the log_exception method mixed into the
resource (Puppet::Type) so that we get resource-specific error
messages.

    Error: /Stage[main]/Main/Notify[hello]: something is not right
Merge branch 'pr/2549'

* pr/2549:
  (PUP-2298) Use resource specific log_exception
  (PUP-2298) protect transaction spec test against new exceptions
  (PUP-2298) add resource lifecycle method Puppet::Type#pre_run_check

Closes GH-2549
Merge pull request #2703 from jpartlow/issue/master/pup-1843-hiera-indirector

Issue/master/pup 1843 hiera indirector
(maint) Remove unused Puppet::Parser::AST::Tag class

It has been hiding in a corner for 8 years. Unused.
Now removed.