Hello,

On 12-01-23 04:45 AM, Jos Houtman wrote:
> I am looking for advice/best-practices on how to handle inter module
> dependency's.
> We have a fairly large/complex code base (100+ modules) with a lot of
> history (we started at 0.24) and lately we have taken into looking how
> we can improve the quality of the codebase.
> Parameterized classes, the style guide are all quick wins and no brainers. 
> 
> But we have some intermodule dependency's, mostly because of ordering,
> for which a proper design pattern is more elusive.

I'm fairly interested in this subject and would like to see what others
have to say here.

>From my experience, modules tend to come in "sets" of inter-dependant
modules, and this makes it sometimes painful to integrate modules from
external sources. Even just merging divergant modules can be quite
tedious. For example, I worked on merging new stuff that was developed
on the nagios module by others in the community.. but since service
resources are declared pretty much _everywhere_ in the module code base,
it took an extensive analysis of what the changes would impact and the
merging process took much more time than it should have because of this.

> A good example is our ldap setup, this setup needs to happen after the
> initialization of our packaging system.
> It also has to happen before a lot of the other modules, because ldap
> provides the details for some of the file owners/groups that are used.
> [...]

In this case, the link between the differring blocks should be
externalized from your ldap module (e.g. the ldap module should care
about stuff related to ldap.. not about relations to other modules).

You could put the order declaration in a "node type" or "node role" kind
of class that you include in your node.
say:

class mysql_server_role {
  include ldap_authentication_role # which declares whatever is needed
                                   # for ldap support
  include mysql

  Class['Ldap'] -> Class['Mysql']
}

-- 
Gabriel Filion

-- 
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