HomePhorge

(#8235) Add plug-in system for tools like Hiera
3ac5b50ce669Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#8235) Add plug-in system for tools like Hiera

A new data_binding indirection is being added for interfacing with
tools like Hiera; and provides an "in-dsl" solution for data separation.
Data exposed by tools like Hiera will be made available during parse
time.

For example, if we had the follow class definition:

class nginx($port=80) { ... }

And it was declared without specifying the port attribute:

class {'nginx': }

The above would result in a data lookup to the data_binding backend for
the following namespaced key:

nginx::port

Namespaced keys are being used to prevent the pollution of the global
namespace. The convention for namespaced keys is a combination of the
class name and the class parameter being resolved.

Example:

class ssh::server($port) { ... } # Lookup ssh::server::port

The data_binding backend would need to provide a value for the
namespaced key or return nil. When a nil value is returned by the
data_binding backend the class parameter default, if available, will be
used instead.

It should be noted that class parameters are looked up one at a time
with no assumptions in regards to the performance of data lookups. It's
the responsibility of the data_binding backend to handle any performance
requirements including caching.

This patch also adds two new terminii: hiera and none. The "none"
terminus implements a find method that always returns nil; it's being
set as the default data_binding terminus to allow end-users the ability
to opt-in and maintain backwards compatibility with older versions of
Puppet.

The "hiera" terminus implements a find method that delegates class
parameter lookups to Hiera using the Hiera Ruby API.

Two new configuration settings are being added:

[main]
  hiera_config = "$confdir/hiera.yaml"
  data_binding_terminus = "none"

Updated specs are included in this patch

Details

Event Timeline

Kelsey Hightower <kelsey@puppetlabs.com> committed rPU3ac5b50ce669: (#8235) Add plug-in system for tools like Hiera (authored by Kelsey Hightower <kelsey@puppetlabs.com>).Apr 26 2012, 2:19 PM