Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#2188 closed change (fixed)

Use class parameter lookup feature with Hiera

Reported by: matze Assignee: matze
Priority: P3 Milestone:
Module: Infrastructure Keywords:
Cc: fhd, fred Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: yes
Review URL(s):

http://codereview.adblockplus.org/5114072680890368

Description

Currently, we use Hiera in two different fashions: As input for our node classifier (hence the classes: key in */roles/*.yaml) and to store arbitrary values with custom keys (which are accessed via the hiera() function).

The latter, however, is in most cases just a replacement for class parameters. This is not only inconsistent, but also not quite obvious. Interestingly though, there is nothing that prevents us from doing both at the same time: Having them as class parameters and being looked up explicitely. See https://docs.puppetlabs.com/hiera/1/puppet.html#automatic-parameter-lookup (especially the Puppet 2.7 note) for more information.

Even better, if we do so, we can remove the explicit hiera() invocations completely after migrating to Puppet 3 in the future - making our entire codebase way more readable.

Currently, only class nagios::server is affected by this nit. Some other existing patch-sets can still be changed before being reviewed or pushed. Together they may serve as an example for the future..

Change History (5)

comment:1 Changed 5 years ago by matze

  • Review URL(s) modified (diff)

comment:2 Changed 5 years ago by matze

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

A patch set has been suggested. Note, however, that this does not remove the need to directly invoke hiera('servers') in e.g. modules/nagios/manifests/server.pp or modules/base/manifests/init.pp though. This is an improvement for another day, after we've migrated to Python 3..

comment:3 Changed 5 years ago by matze

  • Cc fred added
  • Verified working unset

comment:4 Changed 5 years ago by matze

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed 5 years ago by matze

  • Verified working set

Provisioning was successful without any changes to the generated resources, just as expected.

Note: See TracTickets for help on using tickets.