0

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?

smcp
  • 129
  • 2
  • 8
  • Without further information, best guess is that you are attempting to use the Puppet lookup function with a Hiera config < 4. Note you may be using Hiera >= 4, but your config is set to lower. Also, your warning directs you to the 4.10 docs, so you are using a PE later than an equivalent to Puppet 4.7.0. I would guess something along the lines of 2017.2 or 2016.4. More information would help reduce the guessing here though. – Matthew Schuchard Sep 07 '17 at 17:45

1 Answers1

1

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.

smcp
  • 129
  • 2
  • 8