On Monday, January 28, 2013 5:00:24 PM UTC, Ti Leggett wrote:

>
> Thanks for the response. 
>
> Can multiple classes include the same class. Let's say I instantiate the 
> apache class from manifests/nodes.pp which in turns includes 
> apache::params. Can kibana include apache::params then as well with no 
> conflict. I know you can't do this with the class {} style declarations. 
> Also, I thought the class {} style declarations were the preferred way or 
> is that just in the nodes.pp file?


Yes, they can. That's the main selling point for the "include class" 
syntax. And you are right, you can't use the class {...} syntax more than 
once or you get a duplicate definition error.

However, let me warn you against going overboard with having classes 
include other classes from other modules. It can be annoying to track down 
where resources coming from for any given node if you've got cross module 
inclusion: kibana includes httpd includes mod_ssl includes openssl includes 
somethingelse includes ... How did this get on here?

A cleaner way might be to declare cross module relationships using the 
Arrow operators:

class kibana::apache { 
  Class[apache::params] -> Class[kibana::apache]
  ...
}

And then you make a house rule to have all your classes instantiated in 
your node definitions:

node woof {
  class kibana
  class apache::params
}

If apache::params is missing, you'll get an error saying so. It also fits 
rather nicely into an ENC if you want to go in that direction now / later.

-Luke

-- 
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.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to