Hi,
you're giving me some interesting ideas.
Note that the constraint approach mainly concerns itself with module
interoperability, and I do believe that the problem you are describing
is orthogonal to that.
I could see something like this take shape if you manage to combine the
autorequire feature with the additional resource generator (one of my
favorite facilities, so cool).
Generating resources already has many of the semantics you sketched:
- it's a noop if the resource in question is puppet managed anyway
- otherwise it models the current state of the entity in question
(barring modifications such as manipulating ensure for purging)
I can picture a metaparameter such as
service { "foo":
autorequire => { Package["foo"] => { ensure => installed } }
}
that would cause the package to be generated, checked for matching
property (is-)values and required by the service resource.
This would suffer the same limitation that constraints will introduce,
unfortunately, which is a certain loss of self-containment. Modules may
not Just Work out of the box anymore, because they depend on the
provisioning of constrained or autorequired resources by means that are
external to the module.
As far as constraints are concerned, those seem to be our best shot at
solving the steaming mess that is defined/ensure_resource, so we may
have to pay this price.
The autorequire metaparameter would be a very powerful way of easing
manifest design, but I'm not quite sure if we can justify paying the
same price.
Or perhaps I'm wrong. That would be cool then :-)
Cheers,
Felix