puppetlabs/puppet — pull request #718 by kelseyhightower (2012-04-26 12:20:49+00:00)
Title: (#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