For example, I''m trying to define a function to setup the firewall config define fnConfig($pInterface,$pPorts) { file { "/etc/apf/conf.apf": content => template("apf.conf.erb"), notify => Service["apf"], } } However, if I don''t specify anything, I would like it to automatically set $pInterface=''eth0'' and $pPorts=''22,80'' by default. If there something in Puppet like this? define fnConfig($pInterface=''eth0'',$pPorts=''22,80'') { .... } Thanks -- 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.
Dan Bode
2010-May-22 21:26 UTC
Re: [Puppet Users] Default value for arguments of a definition
On Sat, May 22, 2010 at 2:12 PM, mathie <adspeed@gmail.com> wrote:> For example, I''m trying to define a function to setup the firewall > config > > define fnConfig($pInterface,$pPorts) { > file { "/etc/apf/conf.apf": > content => template("apf.conf.erb"), > notify => Service["apf"], > } > } > > However, if I don''t specify anything, I would like it to automatically > set $pInterface=''eth0'' and $pPorts=''22,80'' by default. If there > something in Puppet like this? >that''s exactly how it works.> define fnConfig($pInterface=''eth0'',$pPorts=''22,80'') { > .... > } > > Thanks > > -- > 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<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.