On Monday, March 18, 2013 2:48:11 PM UTC-5, JamieC wrote:
>
> Hello,
>
> I have a class called website, which requires both httpd and mysqld 
> classes. Without defining it within the site.pp (node section). Is it 
> possible to define that "website" requires these additions? Such as;
>
> class website inherits httpd, mysqld {
>
> ...
>
> } 
>
>
You have a completely wrong idea of what class inheritance is for in 
Puppet.  Its appropriate uses are in fact very narrow.  The natural and 
idiomatic expression of what you describe is this:

class website {
  include 'httpd'
  include 'mysqld'
  ...
}

That approach would be better form even if class website needed only one 
other class to be applied.

Note also that that does not in itself say anything about the *order* in 
which resources are applied to clients; rather, it says that all nodes to 
which the 'website' class is assigned also have the 'httpd' and 'mysqld' 
classes assigned to them.  If you need ordering relationships among these 
then there are additional steps you can take.

You certainly do not need a define to express the concept you asked about, 
although you can do it that way, too.  Whether a defined type instance or a 
class is more appropriate for your particular case would involve an 
analysis of your use of the class, but the fact that you can do what you 
want with a class at all is a strong argument for a class being the right 
thing to use.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@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