On 11/09/2016 01:08 AM, Peter Huene wrote:
> Hi bodik,
> 
> On Tue, Nov 8, 2016 at 2:03 AM, bodik <[email protected]
>     everything works fine, but using .pp file containing exactly the same
> 
>             puppet apply tests/class.pp
> 
>     results in "Unknown function:" as shown below, where whole usecase is
>     documented.

> Given that you're using Puppet 4.x, I recommend using the Puppet 4.x
> function API rather than the 3.x API.
> 
> As an example for your custom function, in
> mod1/lib/puppet/functions/myfunc.rb you would have:
> 
> ```
> Puppet::Functions.create_function(:'mod1::myfunc') do
>   dispatch :myfunc do
>     param :Integer, :arg
>   end
> 
>   def myfunc(arg)
>      "returning value #{arg}"
>   end
> end
> ```
> 
> And this would be invoked like `mod1::myfunc(1)`.
> 
> Cheers,
> 
> Peter


Thank you very much, work like a charm.

bodik

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5822D5D3.2000504%40cesnet.cz.
For more options, visit https://groups.google.com/d/optout.

Reply via email to