Adrian Muraru
2012-Sep-24 10:40 UTC
[Puppet Users] "varargs" usage in Parameterized Classes
Is it possible to define a parametrized class but allowing variable number of arguments? thanks, adrian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/fB67qxptB6AJ. 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.
Trevor Vaughan
2012-Sep-24 13:15 UTC
Re: [Puppet Users] "varargs" usage in Parameterized Classes
Your best bet with this, just as in Ruby, is to use a hash. Trevor On Mon, Sep 24, 2012 at 6:40 AM, Adrian Muraru <adi.muraru@gmail.com> wrote:> Is it possible to define a parametrized class but allowing variable number > of arguments? > thanks, > adrian > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/fB67qxptB6AJ. > 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.-- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaughan@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- 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.
Axel Bock
2012-Sep-24 14:19 UTC
[Puppet Users] Re: "varargs" usage in Parameterized Classes
I''ve done it with hashes as Trevor suggests. I do it to pass values to templates, what''s your use case? basically my class looks like this: class myclass( $myhash => {}) { ... } and I use the class like this: myclass { "myclass" : myhash => { "mykey" => "myvalue" }, } works like a charm. HTH, Axel. Am Montag, 24. September 2012 12:40:24 UTC+2 schrieb Adrian Muraru:> > Is it possible to define a parametrized class but allowing variable number > of arguments? > thanks, > adrian >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/8hQWYO8_20EJ. 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.
Adrian Muraru
2012-Sep-25 22:14 UTC
[Puppet Users] Re: "varargs" usage in Parameterized Classes
Thanks, I''ll give it a try! On Monday, September 24, 2012 5:19:30 PM UTC+3, Axel Bock wrote:> > I''ve done it with hashes as Trevor suggests. I do it to pass values to > templates, what''s your use case? > > basically my class looks like this: > class myclass( $myhash => {}) { > ... > } > > and I use the class like this: > myclass { "myclass" : > myhash => { "mykey" => "myvalue" }, > } > > works like a charm. > > > HTH, > Axel. > > > Am Montag, 24. September 2012 12:40:24 UTC+2 schrieb Adrian Muraru: >> >> Is it possible to define a parametrized class but allowing variable >> number of arguments? >> thanks, >> adrian >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7gQBubONPOsJ. 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.