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"? TIA, Jeff --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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. -- Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/ GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216 "Every program in development at MIT expands until it can read mail." -- Unknown --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Nov 04, 2008 at 04:01:06PM +0100, Thomas Bellman wrote:> > 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"; > }Oh, I thought that Jeff''s example did do that, but he wanted: message => "jeff: bin etc lib man ..." Now I tested this and can see that $name gets expanded to an empty string in his example, which I think is a bug. -- Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/ GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216 "Every program in development at MIT expands until it can read mail." -- Unknown --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It''s not a bug - $name is only set by defines. On 5/11/2008, at 4:23 AM, Marcin Owsiany <marcin@owsiany.pl> wrote:> > On Tue, Nov 04, 2008 at 04:01:06PM +0100, Thomas Bellman wrote: >> >> 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"; >> } > > Oh, I thought that Jeff''s example did do that, but he wanted: > message => "jeff: bin etc lib man ..." > > Now I tested this and can see that $name gets expanded to an empty > string in his example, which I think is a bug. > > -- > Marcin Owsiany <marcin@owsiany.pl> http://marcin.owsiany.pl/ > GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 > 1216 > > "Every program in development at MIT expands until it can read mail." > -- > Unknown > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---