Using puppet 0.24.5 (server and client). I''ve written a trivial custom function: module Puppet::Parser::Functions newfunction(:seq, :type => :rvalue) do |args| (args[0].to_i .. args[1].to_i).to_a end end It seems to work as I expect when used as an rvalue in assignment to a variable: $somelist = seq(0, 10) But I get errors if I use it in this context: somedef { seq(0, 10): foo => bar, } I get an error like: err: Could not retrieve catalog: Could not parse for environment production: Syntax error at '':''; expected ''}'' at /etc/puppet/manifests/site.pp:34 Is this expected? A bug? It does work when written like this: $somelist = seq(0, 10) somedef { $somelist: foo => bar, } I was just hoping to avoid defining a variable as an intermediate step. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 Oct 3, 2008, at 2:02 PM, Grumpus wrote:> > Using puppet 0.24.5 (server and client). I''ve written a trivial custom > function: > > module Puppet::Parser::Functions > newfunction(:seq, :type => :rvalue) do |args| > (args[0].to_i .. args[1].to_i).to_a > end > end > > It seems to work as I expect when used as an rvalue in assignment to > a variable: > > $somelist = seq(0, 10) > > But I get errors if I use it in this context: > > > somedef { seq(0, 10): > foo => bar, > } > > I get an error like: > > err: Could not retrieve catalog: Could not parse for environment > production: Syntax error at '':''; expected ''}'' at > /etc/puppet/manifests/site.pp:34 > > Is this expected? A bug?This is a bug; the resource name is apparently set up to be more restrictive than it needs to be. -- Basic research is what I am doing when I don''t know what I am doing. --Wernher von Braun --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 Fri, 2008-10-03 at 15:32 -0500, Luke Kanies wrote:> On Oct 3, 2008, at 2:02 PM, Grumpus wrote: > > > > > Using puppet 0.24.5 (server and client). I''ve written a trivial custom > > function: > > > > module Puppet::Parser::Functions > > newfunction(:seq, :type => :rvalue) do |args| > > (args[0].to_i .. args[1].to_i).to_a > > end > > end > > > > It seems to work as I expect when used as an rvalue in assignment to > > a variable: > > > > $somelist = seq(0, 10) > > > > But I get errors if I use it in this context: > > > > > > somedef { seq(0, 10): > > foo => bar, > > } > > > > I get an error like: > > > > err: Could not retrieve catalog: Could not parse for environment > > production: Syntax error at '':''; expected ''}'' at > > /etc/puppet/manifests/site.pp:34 > > > > Is this expected? A bug? > > This is a bug; the resource name is apparently set up to be more > restrictive than it needs to be.I didn''t think about it before, but this allows resource titles to be non-deterministic and/or different on each run: $var = rand() somedef { $var: foo => bar, } I''m not sure that''s a good thing :-) -- Brice Figureau <brice-puppet@daysofwonder.com> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---