Page MenuHomePhabricator

Add a CI check for the use of hiera() function
Closed, ResolvedPublic

Description

@jbond pointed out in a code review that hiera() is deprecated and eventually removed in Puppet 6; instead lookup() should be used:
https://puppet.com/docs/puppet/5.2/hiera_use_hiera_functions.html

Maybe we should add a CI check which flags the use of hiera()? This way it trickles in naturally and will make a future migration to Puppet 6 simpler.

Event Timeline

I would even suggest if we write a puppet-lint plugin for this to add the fix capability. It should allow a relatively quick removal of all hiera() calls.

the lookup function allows one to call it in multiple ways e.g.

lookup('tcpircbot_host', {'default_value' => 'icinga.wikimedia.org'})
lookup({'name => 'tcpircbot_host', 'default_value' => 'icinga.wikimedia.org'})

It would be good for any lint modification to enfoce one of these styles. The first one is currently the most prevalent so i would vote for that if no other good reasons

Change 522526 had a related patch set uploaded (by Jbond; owner: John Bond):
[operations/puppet-lint/wmf_styleguide-check@master] lookup checks: add checks to warn against using hiera and advice lookup

https://gerrit.wikimedia.org/r/522526

Change 522526 merged by Jbond:
[operations/puppet-lint/wmf_styleguide-check@master] lookup checks: add checks to warn against using hiera and advice lookup

https://gerrit.wikimedia.org/r/522526

jbond claimed this task.