Though not elegant, you could also run it through an inline template. Alternatively, you could write a puppet function that manipulates your data structure appropriately and returns an appropriate answer for you to use in your selector.
Trevor On Sun, Aug 12, 2012 at 1:11 PM, Justin Stoller <jus...@puppetlabs.com> wrote: > On Sun, Aug 12, 2012 at 1:35 AM, Samuel José Martín <faus...@gmail.com> wrote: >> >> Hi, >> >> I am using puppet to generate ipsec tunnels configuration on OpenBSDs >> gateways. >> Having a bunch of offices, I did something like this: >> >> $enc = $office ? >> { >> "paris" => >> { >> "london" => "aes", >> "kiev" => "3des" >> }, >> "london" => >> { >> "paris" => "aes", >> "kiev" => "3des" >> }, >> "kiev" => >> { >> "paris" => "3des", >> "london" => "3des" >> } >> } >> >> This may not be the cleaner way, since I have to specify each variable two >> times - the enc for tunnel from paris to london is obviously the same as the >> one from london to paris. >> However, this works, under OpenBSD 4.9 and our production puppetmaster >> (2.6). >> >> Now, we want to upgrade our firewalls to OpenBSD 5.0. >> Their puppet client version (2.7.1) is forcing us to upgrade our >> puppetmaster too. >> >> My test puppetmaster is running debian wheezy, with puppet* 2.7.14-1. >> While executing puppetd -vt on the client, it fails compiling catalog, with >> some syntax error "at '{'; expected '}'". >> I've just updated my puppetmaster to 2.7.18-1, no changes since my last >> check. >> The faulty "{" is the second one (in my sample, the one just after "paris"). >> >> Is this some regression, in ruby or puppetmaster? >> Or is this kind of syntax deprecated in any way? >> Is there any replacement? > > I think you've found this: > https://projects.puppetlabs.com/issues/14301 -- Hashes can not be > used in selectors > > I don't know how it sits in the deprecated/regression realm. > I think updating your thoughts in the ticket would help move it > forward in development though. > >> What could I do to patch my repository, before upgrading our production >> puppetmaster? > > For the time being (if you don't want to refactor your module in > otherways) you can always assign the hash outside of the selector > (my_test.pp) > > $office = 'paris' > > $paris = { "london" => "aes", "kiev" => "3des" } > $london = { "paris" => "aes", "kiev" => "3des" } > $kiev = { "paris" => "3des", "london" => "3des" } > > $enc = $office ? { > "paris" => $paris, > "london" => $london, > "kiev" => $kiev > } > > notify { $enc['london']: } > > > > > - Justin > >> >> >> Thanks for your help, >> >> Regards. >> >> -- >> 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/-/dJiuo5sjBYwJ. >> 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. > > -- > 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. > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaug...@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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.