Why is rspec-puppet behaviour different for hiera lookup using 'lookup' or 'hiera' functions?

530 Views Asked by At

Running rake spec tests I am getting:

Warning: The function 'hiera' is deprecated in favor of using 'lookup'. See 
https://docs.puppet.com/puppet/4.10/reference/deprecated_language.html
(file & line not available)

So I decided to change to using lookup. However my hiera lookups are now not working

v1 = lookup('key') # doesn't work
v2 = hiera('key', undef) #works

I'm using rspec-puppet-2.5.0 and onceover 3.2.0, because otherwise other things don't work with the Puppet Enterprise version we're using (equivalent to puppet 4.7.0) (don't you just love Ruby versioning).

What I suspect is that something in the interception of lookup by rspec-puppet is not working properly and the correct hiera.yaml is not being found. Before I go debugging I was wondering if someone had already seen this?

1

There are 1 best solutions below

0
On

Thanks a lot @matt-schuchard. That is the very reason: the hiera config v3. So I was approaching the refactor in the wrong direction. First upgrade the hiera and then the puppet code itself is the correct sequence for this.