Hi All,

I'm stumbling over two problems, while trying to port over a custom
hiera backend from hiera 3 to hiera 5.

I was able to simplify the problem I have to a simple example and I
think it shows

a) Documentation is wrong
b) You can't use Puppet Data types in ruby functions, at least not in my
example.

Essentially, the simplification of my problem all boils down to call
lookup with a certain set of parameters.

I have pushed an example repository that shows within a very compressed
version what is failing:

https://github.com/duritong/puppet_function_and_types

The first 2 ways (line 9 & 10) of calling the lookup function just don't
match a potential signature of lookup. And based on the signature errors
I get, I can only conclude that the official documentation at

https://docs.puppet.com/puppet/5.0/functions_ruby_implementation.html#calling-other-functions

"The second argument must be an array containing any arguments to the
function."

is *wrong*! As you can read out of the signature matching error message.

=> assumption a)

So let's then try without the arguments being an array:

Line 46 => Oh, looks like it matches, but can't compare Ruby Hash to
puppet Hash type. :/

Line 74 => Oh, looks like the String 'Hash' is not detected as Type, so
it indicates that this way of calling the function is right, but I am
still not able to define a ValueType.

=> assumption b)

So the only way it works: Line 89 which does not enforce any ValueType,
but everything else works.

I'm still pretty new to the type system and not yet deep into puppet 4/5
functions, but from my current perspective a) and b) are true.

best

~pete


-- 
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/9dc67243-42b3-3f9c-f869-676d15b55836%40immerda.ch.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to