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