Shantanu
2013-Apr-08 21:10 UTC
[Puppet Users] Puppet parameterized class - include for declaration?
The parameterized classes guide mentions that a parameterized class is declared using following syntax [1]: class {''classname'': } But the puppetlabs postgresql module<https://github.com/puppetlabs/puppet-postgresql#setup>mentions that a parameterized class '' postgresql::server<https://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp>'' can be declared using ''include'' syntax [2]. So is ''include'' syntax supported for parameterized classes now? -- Shantanu 1. http://docs.puppetlabs.com/guides/parameterized_classes.html 2. https://github.com/puppetlabs/puppet-postgresql#setup -- 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+unsubscribe@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.
joe
2013-Apr-09 07:18 UTC
[Puppet Users] Re: Puppet parameterized class - include for declaration?
You can include a parameterized class as long as all it''s parameters have default values. On Monday, April 8, 2013 3:10:03 PM UTC-6, Shantanu wrote:> > > The parameterized classes guide mentions that a parameterized class is > declared using following syntax [1]: > > class {''classname'': } > > > But the puppetlabs postgresql module<https://github.com/puppetlabs/puppet-postgresql#setup>mentions that a parameterized class '' > postgresql::server<https://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp>'' > can be declared using ''include'' syntax [2]. > > So is ''include'' syntax supported for parameterized classes now? > > -- > Shantanu > > > 1. http://docs.puppetlabs.com/guides/parameterized_classes.html > 2. https://github.com/puppetlabs/puppet-postgresql#setup > > >-- 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+unsubscribe@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.
jcbollinger
2013-Apr-09 13:00 UTC
[Puppet Users] Re: Puppet parameterized class - include for declaration?
On Monday, April 8, 2013 4:10:03 PM UTC-5, Shantanu wrote:> > > The parameterized classes guide mentions that a parameterized class is > declared using following syntax [1]: > > class {''classname'': } > > > But the puppetlabs postgresql module<https://github.com/puppetlabs/puppet-postgresql#setup>mentions that a parameterized class '' > postgresql::server<https://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp>'' > can be declared using ''include'' syntax [2]. > > So is ''include'' syntax supported for parameterized classes now? > >The ''include'' function has always worked with parameterized classes. It just doesn''t bind any parameter values to the named class. Indeed, the parameterized-style class declaration syntax is better viewed as a *parameter binding* syntax, with a side effect of declaring the class. That makes it a lot easier to understand its constraints -- principally, that if a parameterized-style class declaration is used, for a given class then it must be the first declaration of that class that is evaluated. (Any number of ''include'' declarations may be used for the same class.) Using the ''include'' function with parameterized classes makes especial sense when relying exclusively on Puppet 3''s automated hiera-based data binding, because there is nothing but downside to using empty parameterized-style class declarations. Note, too, that you can use (empty) parameterized declarations for UNparameterized classes. But don''t do that. 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+unsubscribe@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.
Peter Brown
2013-Apr-09 23:40 UTC
Re: [Puppet Users] Re: Puppet parameterized class - include for declaration?
On 9 April 2013 17:18, joe <lavaman@gmail.com> wrote:> You can include a parameterized class as long as all it''s parameters have > default values.or you use hiera or an External Node Classifier to automagically set the variables that don''t have defaults or override that ones you need to.> > > On Monday, April 8, 2013 3:10:03 PM UTC-6, Shantanu wrote: >> >> >> The parameterized classes guide mentions that a parameterized class is >> declared using following syntax [1]: >> >> class {''classname'': } >> >> >> But the puppetlabs postgresql module<https://github.com/puppetlabs/puppet-postgresql#setup>mentions that a parameterized class '' >> postgresql::server<https://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp>'' >> can be declared using ''include'' syntax [2]. >> >> So is ''include'' syntax supported for parameterized classes now? >> >> -- >> Shantanu >> >> >> 1. http://docs.puppetlabs.com/**guides/parameterized_classes.**html<http://docs.puppetlabs.com/guides/parameterized_classes.html> >> 2. https://github.com/puppetlabs/**puppet-postgresql#setup<http://github.com/puppetlabs/puppet-postgresql#setup> >> >> >> -- > 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+unsubscribe@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. > > >-- 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+unsubscribe@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.
Shantanu
2013-Apr-10 22:00 UTC
[Puppet Users] Re: Puppet parameterized class - include for declaration?
On Tuesday, April 9, 2013 8:00:40 AM UTC-5, jcbollinger wrote:> > > > On Monday, April 8, 2013 4:10:03 PM UTC-5, Shantanu wrote: >> >> >> The parameterized classes guide mentions that a parameterized class is >> declared using following syntax [1]: >> >> class {''classname'': } >> >> >> But the puppetlabs postgresql module<https://github.com/puppetlabs/puppet-postgresql#setup>mentions that a parameterized class '' >> postgresql::server<https://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp>'' >> can be declared using ''include'' syntax [2]. >> >> So is ''include'' syntax supported for parameterized classes now? >> >> > The ''include'' function has always worked with parameterized classes. It > just doesn''t bind any parameter values to the named class. Indeed, the > parameterized-style class declaration syntax is better viewed as a *parameter > binding* syntax, with a side effect of declaring the class. That makes > it a lot easier to understand its constraints -- principally, that if a > parameterized-style class declaration is used, for a given class then it > must be the first declaration of that class that is evaluated. (Any number > of ''include'' declarations may be used for the same class.) > > Using the ''include'' function with parameterized classes makes especial > sense when relying exclusively on Puppet 3''s automated hiera-based data > binding, because there is nothing but downside to using empty > parameterized-style class declarations. > > Note, too, that you can use (empty) parameterized declarations for > UNparameterized classes. But don''t do that. > > > John > > >Thanks for explaining it John. I have always used empty parameterized declaration syntax. I had wrongly assumed that include won''t work with it. -- Shantanu -- 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+unsubscribe@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.