Custom function errors

141 views
Skip to first unread message

Karolis Pabijanskas

unread,
May 16, 2014, 8:46:27 AM5/16/14
to puppet...@googlegroups.com
Hi All,

I'm having issues with what seems to be incorrect parsing by all the custom functions we have.

If I run "ruby -rpuppet" I get something like:

[root@puppet modules]# ruby -rpuppet /var/lib/puppet/lib/puppet/parser/functions/foreman.rb 
/usr/lib/ruby/site_ruby/1.8/puppet/parser/functions.rb:242:in `merged_functions': undefined method `[]' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions.rb:247:in `get_function'
from /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions.rb:132:in `newfunction'
from /var/lib/puppet/lib/puppet/parser/functions/foreman.rb:38

This exact error appears on every single custom function, including all the stdlib ones (naturally, only the last line differs slightly)

The 38th line in the foreman.rb file is the newfunction call:

module Puppet::Parser::Functions
  newfunction(:foreman, :type => :rvalue) do |args|

Nothing further gets called ever, on any of the functions.

I had a quick look through those libraries, but as I'm not a ruby black belt, this seems a bit beyond me.

Does anyone have any idea what could be causing this, or could point me where to look at for further torubleshooting?

Note, this is apparent on both puppet 3.5.1 and 3.6, ruby 1.8.7 (from centos repositories).




Thanks in advance!

Karolis

David Schmitt

unread,
May 18, 2014, 7:28:46 AM5/18/14
to puppet...@googlegroups.com
From my cursory reading of the functions.rb, your "ruby -rpuppet" call
seems to be missing a call to "Puppet::Parser::Functions#reset". I'm not
sure why you would expect the ruby call to work out?


Regards, David

Karolis Pabijanskas

unread,
May 19, 2014, 5:35:13 AM5/19/14
to puppet...@googlegroups.com
Hi David,

Thanks. That was indeed the case.

The "ruby -rpuppet" just proved to me that the custom functions we're not parsed correctly in puppet either (no helpful errors even there though). Once I added the reset, all started working fine inside puppet too.

Thanks a lot!

Regards,
Karolis




--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5378996E.8030606%40dasz.at.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages