Digant C Kasundra
2011-Aug-23 18:00 UTC
[Puppet Users] Parameterized classes vs defined-types
Out of curiosity, how are people using parameterized classes in a way that is distinct from defined-types? -- Digant C Kasundra <digant@stanford.edu> Infrastructure Systems Software Developer, ITS:IDG, Stanford University -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2011-Aug-24 13:46 UTC
[Puppet Users] Re: Parameterized classes vs defined-types
On Aug 23, 1:00 pm, Digant C Kasundra <dig...@stanford.edu> wrote:> Out of curiosity, how are people using parameterized classes in a way that is distinct from defined-types?<snark>I am _using_ defined types, that''s how.</snark> Although I disfavor parameterized classes and do not use them, the pattern of my usage of defined types could not be implemented via parameterized classes. In particular, I typically do not define a type unless I plan to instantiate it multiple times for the same node. You cannot do that with parameterized classes. If you have an OO background then the words "class" and "type" may have connotations and implied similarity for you that just don''t apply in Puppet. Puppet classes are not "types" in the type theory sense. Defined types are closer to that, but it may help to use a fuller name when you think about them: defined *resource* types. Classes, parameterized or not, are not resource types; rather, they are resource _collections_. 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Henrik Lindberg
2011-Aug-24 17:06 UTC
Re: [Puppet Users] Re: Parameterized classes vs defined-types
On 8/24/11 3:46 PM, jcbollinger wrote:> If you have an OO background then the words "class" and "type" may > have connotations and implied similarity for you that just don''t apply > in Puppet. Puppet classes are not "types" in the type theory sense. > Defined types are closer to that, but it may help to use a fuller name > when you think about them: defined *resource* types. Classes, > parameterized or not, are not resource types; rather, they are > resource _collections_.I find it helps me to think of classes as *host*-class = a type of host classification (i.e. like measurements Weight and Height) - it is nonsensical to classify it multiple times e.g size = big, size = small, at best it would be redundant (size = big, size = big) to classify a host with the same puppet class multiple times (but I think that special case is also flagged as an error - which it should because the structure is clearly wrong). Please correct me if I am wrong - I am also learning puppet. - henrik -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Digant C Kasundra
2011-Aug-24 18:26 UTC
Re: [Puppet Users] Re: Parameterized classes vs defined-types
----- Original Message -----> On Aug 23, 1:00 pm, Digant C Kasundra <dig...@stanford.edu> wrote: > > Out of curiosity, how are people using parameterized classes in a > > way that is distinct from defined-types? > > <snark>I am _using_ defined types, that''s how.</snark> > > Although I disfavor parameterized classes and do not use them, the > pattern of my usage of defined types could not be implemented via > parameterized classes. In particular, I typically do not define a > type unless I plan to instantiate it multiple times for the same > node. You cannot do that with parameterized classes. > > If you have an OO background then the words "class" and "type" may > have connotations and implied similarity for you that just don''t apply > in Puppet. Puppet classes are not "types" in the type theory sense. > Defined types are closer to that, but it may help to use a fuller name > when you think about them: defined *resource* types. Classes, > parameterized or not, are not resource types; rather, they are > resource _collections_.I agree with you. I think that''s why I''m curious. We also overrides on defined types, which is why we prefer them as well. I think while it may be possible to do what we are currently doing with parameterized classes, it would at least involve a lot of restructuring how we think of things in our manifests. -- Digant C Kasundra <digant@stanford.edu> Infrastructure Systems Software Developer, ITS:IDG, Stanford University -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.