On 11/09/2016 01:08 AM, Peter Huene wrote:
> Hi bodik,
>
> On Tue, Nov 8, 2016 at 2:03 AM, bodik <
bo...@cesnet.cz
> 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