On 2015-14-05 12:58, Alessandro Franceschi wrote:
Hi all,
sorry to bother, I should probably search around better but I'm quite
confident that I can find here a quick solution.

I've this issue: https://github.com/example42/puppi/issues/123 in a
function which tries to use the hiera function as follows:

value = function_hiera(["#{module_name}_#{var_name}", ''])


The error message comes from the 3.x API  hiera class in
lib/parser/functions/

|Error: Evaluation Error: Error while evaluating a Function Call, hiera() has 
been converted to 4x API|


Wha's the syntax to use an API4 function inside a function?
Maybe should I move the function in my module from
lib/puppet/parser/functions to lib/puppet/functions and edit something?

If you change your function to use the 4.x API then it can call any function (3.x or 4.x) using the method call_function. This works from 3.7.5 (earlier version had a problem in calling a 3.x function from 4.x - see https://tickets.puppetlabs.com/browse/PUP-3548).

For the 4.x function API see the language specification.

You can support both 3.x. and 4.x by just adding a 4.x function with the same name. 4.x. functions have higher precedence when using future parser (and 4.x. functions are not visible at all when not using future parser).

If you really do not want to migrate the function to the 4.x. API then you could write a utility class to perform the call - the logic to do this is is here: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/pops/evaluator/runtime3_support.rb#L234

Regards
- henrik

Thanks * for any help
al

--
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
<mailto:puppet-dev+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/d6e542ff-854f-4b46-a568-96f418586af5%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-dev/d6e542ff-854f-4b46-a568-96f418586af5%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
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/mj227v%24oh3%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to