On Jan 23, 3:45 am, Jos Houtman <j...@hyves.nl> wrote:
> Hello list,
>
> I am looking for advice/best-practices on how to handle inter module
> dependency's.

[...]

> Without stages we tried three ways of doing this:
> Creating a dependency chain between classes.
> Class['Ldap'] -> Class['Mysql'].
> This is very easy to do, but doesn't work if we inherit from Ldap,  say:
>  class ldap::server inherits ldap
> The ordering between ldap::server and Mysql is not guaranteed.
> It also requires the maintainer of the ldap module to know about all
> modules that depend on ldap and update them if he decides to inherit. A
> task that is likely to be forgotten.


That's one of many reasons to not do that.  Specifically, one should
employ class inheritance only when it involves overriding resource
properties of the parent class.  Where all you really want is to
compose classes (as I infer is the case you describe), you should
instead use the 'include' function, the 'require' function, or a
resource-style class declaration.

If you use class inheritance *only* to override resource properties
(subclass bodies contain nothing but resource overrides) then I think
your subclasses will not suffer from the problem you describe.  That's
a more restrictive rule than I impose on myself, but it might be
useful to you.

You will already have recognized that none of this solves your problem
directly.  Effective dependency management requires discipline,
planning, documentation, and the occasional large-scale refactoring.
Correct use of class inheritance fits in mostly by shaping the
expectations and practices of manifest developers, rather than by
providing tools to directly control ordering.  I hope you nevertheless
find this useful.


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