Opened on 03/20/2015 at 12:28:48 PM

Closed on 04/02/2015 at 01:49:47 PM

Last modified on 04/02/2015 at 02:02:23 PM

#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..

Attachments (0)

Change History (5)

comment:1 Changed on 03/20/2015 at 01:23:00 PM by matze

  • Review URL(s) modified (diff)

comment:2 Changed on 03/20/2015 at 01:44:16 PM 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 on 03/31/2015 at 12:47:49 PM by matze

  • Cc fred added
  • Verified working unset

comment:4 Changed on 04/02/2015 at 01:49:47 PM by matze

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

comment:5 Changed on 04/02/2015 at 02:02:23 PM by matze

  • Verified working set

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

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from matze.
 
Note: See TracTickets for help on using tickets.