On Thursday, September 6, 2012 11:48:40 PM UTC+2, Andreas Ntaflos wrote: > > On 2012-09-04 17:26, Bai Shen wrote: > > class solr { > > I recommend you follow best practices and not manage every aspect of > your Solr resource in a single class, but split it up into subclasses, > probably at least: solr::install (install.pp), solr::config (config.pp), > solr::service (service.pp). The solr class (init.pp) then includes all > subclasses and explicitly declares their dependencies among each other, > like so: > > class solr { > include 'solr::install' > include 'solr::config' > include 'solr::service' > > Class['solr::install'] > -> Class['solr::config'] > ~> Class['solr::service'] > } > > This makes it easier to manage and change later on. >
If I may add my very personal 2 cents to this approach, I have to say that this is IMHO the worst "best practice" ever suggested for Puppet modules, even if it's written on Puppet Pro and has been originally suggested by a giant like R.I.P., if I remember well. It my opinion if has 2 major defects: - It multiplies the number of objects needed to manage the same things (at scale you feel it) without really giving a great advantage if not having a bit more comfortable dependency management. - Most of all, it makes a real PITA any attempt to override some of the resources parameters using class inheritance (yes, the more you avoid class inheritance and the better, but if your module doesn't provide a way to (re)define the behaviour of most of the resources defined in these classes, trying to change them without changing the module becomes almost impossible). No flames intended :-) Alessandro Franceschi -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/yp_L1yPt5_IJ. 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.