Can anyone tell me what this means? puppetd --test notice: Ignoring cache err: Could not retrieve configuration: return can''t jump across threads at /var/puppet/modules/atg/manifests/init.pp:298 on node On that line, I call this custom function: module Puppet::Parser::Functions require ''inifile'' newfunction(:awi_ports, :type=>:rvalue) do |args| type = args[0] server = args[1] ini = IniFile::new( ) ini.load("/var/puppet/modules/atg/manifests/ports.conf") if ini[type].nil? == true return -1 end ini[type].each { |k, v| if k==server return v else return -1 end } end end 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 Feb 17, 2009, at 9:42 AM, Jeff wrote:> > Can anyone tell me what this means? > > puppetd --test > notice: Ignoring cache > err: Could not retrieve configuration: return can''t jump across > threads at /var/puppet/modules/atg/manifests/init.pp:298 on node > > On that line, I call this custom function: > > module Puppet::Parser::Functions > > require ''inifile'' > > newfunction(:awi_ports, :type=>:rvalue) do |args| > type = args[0] > server = args[1] > ini = IniFile::new( ) > ini.load("/var/puppet/modules/atg/manifests/ports.conf") > > if ini[type].nil? == true > return -1 > end > > ini[type].each { |k, v| > if k==server > return v > else > return -1 > end > } > end > endHrm, that''s clearly a ruby error, and it''s one I''ve never seen. I can''t think of what it would be, and it doesn''t look like you''re doing anything with threads. Maybe IniFile is doing threading that you need to be cognizant of? -- Anyone who considers arithmatical methods of producing random digits is, of course, in a state of sin. --John Von Neumann --------------------------------------------------------------------- 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 Feb 17, 12:43 pm, Luke Kanies <l...@madstop.com> wrote:> On Feb 17, 2009, at 9:42 AM, Jeff wrote: > > Can anyone tell me what this means? > > puppetd --test > > notice: Ignoring cache > > err: Could not retrieve configuration: return can''t jump across > > threads at /var/puppet/modules/atg/manifests/init.pp:298 on node > > > On that line, I call this custom function: > > > module Puppet::Parser::Functions > > > require ''inifile'' > > > newfunction(:awi_ports, :type=>:rvalue) do |args| > > type = args[0] > > server = args[1] > > ini = IniFile::new( ) > > ini.load("/var/puppet/modules/atg/manifests/ports.conf") > > > if ini[type].nil? == true > > return -1 > > end > > > ini[type].each { |k, v| > > if k==server > > return v > > else > > return -1 > > end > > } > > end > > end > > Hrm, that''s clearly a ruby error, and it''s one I''ve never seen. I > can''t think of what it would be, and it doesn''t look like you''re doing > anything with threads. Maybe IniFile is doing threading that you need > to be cognizant of? >Here''s a copy of inifile: http://www.hermann-paul.org/pix/inifile.txt I''m still feeling my way through ruby but I don''t see anything to indicate that it''s spawning threads... Any thoughts? 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 Feb 17, 12:53 pm, Jeff <joesi...@gmail.com> wrote:> On Feb 17, 12:43 pm, Luke Kanies <l...@madstop.com> wrote: > > > > > On Feb 17, 2009, at 9:42 AM, Jeff wrote: > > > Can anyone tell me what this means? > > > puppetd --test > > > notice: Ignoring cache > > > err: Could not retrieve configuration: return can''t jump across > > > threads at /var/puppet/modules/atg/manifests/init.pp:298 on node > > > > On that line, I call this custom function: > > > > module Puppet::Parser::Functions > > > > require ''inifile'' > > > > newfunction(:awi_ports, :type=>:rvalue) do |args| > > > type = args[0] > > > server = args[1] > > > ini = IniFile::new( ) > > > ini.load("/var/puppet/modules/atg/manifests/ports.conf") > > > > if ini[type].nil? == true > > > return -1 > > > end > > > > ini[type].each { |k, v| > > > if k==server > > > return v > > > else > > > return -1 > > > end > > > } > > > end > > > end > > > Hrm, that''s clearly a ruby error, and it''s one I''ve never seen. I > > can''t think of what it would be, and it doesn''t look like you''re doing > > anything with threads. Maybe IniFile is doing threading that you need > > to be cognizant of? > > Here''s a copy of inifile:http://www.hermann-paul.org/pix/inifile.txt > > I''m still feeling my way through ruby but I don''t see anything to > indicate that it''s spawning threads... > > Any thoughts? >UPDATE: I tried this ini parser and had a similar result: http://rubyforge.org/frs/?group_id=2907&release_id=9047 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Boy, that error message was helpful. Basically it''s a scope issue. You have to assign the hash value to a local variable and return that. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Lutterkort
2009-Feb-17 19:19 UTC
[Puppet Users] Re: Bizarre error with custom function
On Tue, 2009-02-17 at 07:42 -0800, Jeff wrote:> puppetd --test > notice: Ignoring cache > err: Could not retrieve configuration: return can''t jump across > threads at /var/puppet/modules/atg/manifests/init.pp:298 on node > > On that line, I call this custom function: > > module Puppet::Parser::Functions > > require ''inifile'' > > newfunction(:awi_ports, :type=>:rvalue) do |args| > type = args[0] > server = args[1] > ini = IniFile::new( ) > ini.load("/var/puppet/modules/atg/manifests/ports.conf") > > if ini[type].nil? == true > return -1 > end > > ini[type].each { |k, v| > if k==server > return v > else > return -1 > end > } > end > endIt might be an issue with using return inside the block - I have dark memories of screwing that up. IIRC, you can''t use return inside the block when the block is being passed around, and have to use the very counter-intuitive ''next'' instead. David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---