On Jan 26, 11:00 am, jcbollinger <john.bollin...@stjude.org> wrote:
> If we must rely only on features already present in Puppet, then I
> think that's heading in the right direction.

On the other hand, if we can wish for new features to address this
area, then there may be altogether different approaches available.  In
particular, it is useful to recognize that dependencies are not just
on a particular resource generally -- rather, they are on a particular
resource having certain specific properties.  For example, a web
server module doesn't just rely on, say, Package['httpd'].  Rather, it
relies on that package having an 'ensure' parameter different from
'absent' and 'purged'.  Puppet DSL does not currently have a means to
express that.

Consider, then, a new metaresource type, Constraint.  The purpose of
the Constraint resource type would be to allow multiple unrelated
classes to collaborate on defining the properties of a single
resource, and it would do so by allowing classes to limit the values
that chosen resource properties may have.

At compilation time, Puppet would collect and combine all the
constraints on any particular resource, and use the results to set
unspecified property values and validate specified ones.  Usage might
look something like this:

constraint { 'webserver-httpd_package-present':
    resource => Package['httpd'],
    property => 'ensure',
    forbidden_value => [ 'absent', 'purged' ],
# also available: allowed_value
# maybe: default_value
}

Not only would this nicely meet the needs of different modules to
express their requirements on shared resources, it would also make it
much easier to recognize resource conflicts.  If Puppet automatically
generated empty resource definitions to constrain when it discovered
constraints on otherwise-undefined resources, then that would also
overcome the problem of deciding where to define particular resources.

I can imagine many -- perhaps most -- resource definitions being
replaced or supplemented by constraint declarations.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to