Re: [Puppet Users] "varargs" usage in Parameterized Classes

61 views
Skip to first unread message

Trevor Vaughan

unread,
Sep 24, 2012, 9:15:17 AM9/24/12
to puppet...@googlegroups.com
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.m...@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...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@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
tvau...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

Axel Bock

unread,
Sep 24, 2012, 10:19:30 AM9/24/12
to puppet...@googlegroups.com
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.

Adrian Muraru

unread,
Sep 25, 2012, 6:14:08 PM9/25/12
to puppet...@googlegroups.com
Thanks, I'll give it a try!
Reply all
Reply to author
Forward
0 new messages