(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).