Hello all. Are there any rule of thumb regarding using "inherits" versus "include"? For example, if I''m creating the class "syslog::base" which should servere as a building block for syslog clients, should I go for a "class syslog::client inherits syslog::base { <something> }" or "class syslog::client { include syslog::base }"? Best regards, Kenneth -- 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.
On Aug 31, 10:09 am, Kenneth Holter <kenneho....@gmail.com> wrote:> Hello all. > > Are there any rule of thumb regarding using "inherits" versus "include"? For > example, if I''m creating the class "syslog::base" which should servere as a > building block for syslog clients, should I go for a "class syslog::client > inherits syslog::base { <something> }" or "class syslog::client { include > syslog::base }"?Directly from the horse''s mouth (we have training this week)... Inherits should only be used when you actually intend to use inherits with overrides. If you don''t it makes the code less understandable than if you just used includes. It''s more a code understandability issue than functionality. Apparently there are many instances of both questions and good answers to this question in the group archives too. -- 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.
On Tue, Aug 31, 2010 at 4:35 AM, Oliver Hookins <ohookins@gmail.com> wrote:> On Aug 31, 10:09 am, Kenneth Holter <kenneho....@gmail.com> wrote: >> Hello all. >> >> Are there any rule of thumb regarding using "inherits" versus "include"? For >> example, if I''m creating the class "syslog::base" which should servere as a >> building block for syslog clients, should I go for a "class syslog::client >> inherits syslog::base { <something> }" or "class syslog::client { include >> syslog::base }"? > > Directly from the horse''s mouth (we have training this week)... > Inherits should only be used when you actually intend to use inherits > with overrides. If you don''t it makes the code less understandable > than if you just used includes. It''s more a code understandability > issue than functionality.++ You really don''t want to bother with inherits unless you''re overriding resources in the parent. I still feel like we don''t have a good term for "namespace" children classes, as in a succinct and accurate term for the relationship between "syslog" and "syslog::foo". They''re not child classes, they''re ... ?> > Apparently there are many instances of both questions and good answers > to this question in the group archives too. > > -- > 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. > >-- nigel -- 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.
On Tue, Aug 31, 2010 at 11:48 AM, Nigel Kersten <nigelk@google.com> wrote:> I still feel like we don''t have a good term for "namespace" children > classes, as in a succinct and accurate term for the relationship > between "syslog" and "syslog::foo". They''re not child classes, they''re > ... ?How about BFF? Cohorts? They''re all usually part of the same module, so I think something that indicates that module-level loose relationship would be ideal. -Jeff -- 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.
On Aug 31, 2010, at 11:48 AM, Nigel Kersten wrote:> On Tue, Aug 31, 2010 at 4:35 AM, Oliver Hookins <ohookins@gmail.com> wrote: >> On Aug 31, 10:09 am, Kenneth Holter <kenneho....@gmail.com> wrote: >>> Hello all. >>> >>> Are there any rule of thumb regarding using "inherits" versus "include"? For >>> example, if I''m creating the class "syslog::base" which should servere as a >>> building block for syslog clients, should I go for a "class syslog::client >>> inherits syslog::base { <something> }" or "class syslog::client { include >>> syslog::base }"? >> >> Directly from the horse''s mouth (we have training this week)... >> Inherits should only be used when you actually intend to use inherits >> with overrides. If you don''t it makes the code less understandable >> than if you just used includes. It''s more a code understandability >> issue than functionality. > > ++ > > You really don''t want to bother with inherits unless you''re overriding > resources in the parent. > > I still feel like we don''t have a good term for "namespace" children > classes, as in a succinct and accurate term for the relationship > between "syslog" and "syslog::foo". They''re not child classes, they''re > ... ? >I might call them "nested classes". ---------------------- Charles Yeomans Senior Software Engineer Dakim, Inc. charles@dakim.com -- 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.