Thomas Bellman <bell...@nsc.liu.se> writes: > Yes, but Paul seemed to argue that having array parameters and looping over > them was "un-Puppet-like" and bad design. And then he suggested a variant > that still used array parameters. I happen to disagree with that sentiment.
I think this is about where I'm coming from. I don't think I can define a custom type, and the native puppet support isn't quite enough rope. I don't think it's a declarative vs. procedural issue. > That said, there is a way to loop over arrays within Puppet, and that > is by passing it as the name to a helper definition. The OP would do > something like this: > > define keystore($keys, ...) > { > keystore_helper { > $keys: ...; > } > ... > } > > define keystore_helper(...) > { > # Each element of $keys will be available as $name here > # Do something with it here > ... > } > > This is not unproblematic at the moment, though. Since the name must > be unique for each keystore_helper declaration, that makes it impossible > to have more than one keystore declaration with the same keys parameter. > One would have to preprocess the $keys parameter to prepend the keystore > name to each element, and there's no way to do that in stock 0.24.8. > (I think you will be able to do it in 0.25, by abusing inline_template() > and split(), but that's rather ugly.) Exactly. I'd love for names to be multidimensional. seph --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---