Hi,

I am playing with Puppet 4 functions.
According to Henriks blog[1] one can provide information on number of arguments 
for a function using arg_count inside the dispatch.

The following code will throw an error:

# modules/utils/lib/puppet/functions/resolver.rb
require 'socket'
Puppet::Functions.create_function(:resolver) do
  dispatch :hostname do
    arg_count 0, 0
  end
  def hostname()
    Socket.gethostname
  end
end

Error: Evaluation Error: Error while evaluating a Function Call, undefined 
method `arg_count' for #<Puppet::Functions::DispatcherBuilder:0x00000004cbd280> 
at 
/etc/puppetlabs/code/environments/production/modules/functions/manifests/init.pp:2:15
 on node puppetmaster.example.net

I had aloof on the functions.rb file in PC1 
(/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/functions.rb).
No arg_count function is available.

Is arg_count a feature which will be available with an upcoming version?

Any other way to provide information regarding amount of arguments?

Best,
Martin

[1] 
http://puppet-on-the-edge.blogspot.de/2015/01/the-puppet-4x-function-api.html

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/DC6ACD6A-0D23-4DD5-AAF7-EE625C7EED56%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to