Marcin Owsiany wrote:
> On Tue, Nov 04, 2008 at 06:03:24AM -0800, Jeff wrote:
>> How do I reference the values of the array in this block:
>>
>> notify { ["bin", "etc", "lib", "man", "src", "tmp", "var"] :
>> message => "jeff: $name"
>> }
>>
>> i.e., what do I use in place of "$name"?
>
> As far as I know, foo { [a, b, c]: } is purely a syntactic shortcut for:
> foo { a: } foo { b: } foo { c: }
>
> In other words, there are actually 7 different resources in your example.
But, what he wants to do is to avoid having to repeat all the "bin", "etc",
and so on; he doesn't want to write:
notify {
"bin": message => "jeff: bin";
"etc": message => "jeff: etc";
"lib": message => "jeff: lib";
}
You can do it by creating a custom define:
define mynotify($recipient) {
notify { $name: message => "$recipient: $name"; }
}
mynotify {
["bin", "etc", "lib", "man", "src", "tmp", "var"]:
recipient => "jeff";
}
I believe that's the only way to do it.
/Bellman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---