Jira (PUP-10239) Modules should have the ability to add data to the Hiera layer of the module and have it affect other modules default lookup settings.

6 views
Skip to first unread message

Trevor Vaughan (JIRA)

unread,
Jan 17, 2020, 1:54:04 PM1/17/20
to puppe...@googlegroups.com
Trevor Vaughan created an issue
 
Puppet / Improvement PUP-10239
Modules should have the ability to add data to the Hiera layer of the module and have it affect other modules default lookup settings.
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: Language
Created: 2020/01/17 10:53 AM
Priority: Normal Normal
Reporter: Trevor Vaughan

Puppet Version: 5+
Puppet Server Version: 5+
OS Name/Version: Any

When creating profiles and/or roles, I would like the ability to be able to have my module data affect the default lookups of other modules.

Desired Behavior:

If I have a webserver profile, I would like to be able to add data in the modules' hiera layer to affect the defaults for the apache class or the nginx class without adding clutter to my puppet manifests.

I imagine that this would be a setting that would have to be explicitly enabled in the module data to tell HIera to delve into the modules for all defaults unless a higher level default is found.

Actual Behavior:

Functionality currently does not exist

CC: Henrik Lindberg

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
Jan 17, 2020, 2:26:03 PM1/17/20
to puppe...@googlegroups.com
Henrik Lindberg commented on Improvement PUP-10239
 
Re: Modules should have the ability to add data to the Hiera layer of the module and have it affect other modules default lookup settings.

It was a very conscious design decision to not let a module define anything outside of its namespace by just having the module on the modulepath.
In order to configure anything else this must be designed into modules that want such cooperation, or by someone that adds this as a feature to mix into the hierarchy.

There is already a default_hierarchy separate from the regular hierarchy - only used if regular hierarchy does not produce a value.

Cooperation between modules can be done by referencing data files in another module (or environment) - then there is no restriction on namespace, data files are simply data and any restrictions would depend on where those files are referenced; for example if module A uses a path that references a file in module B, then the data must have keys that are namespaced for A.

Cooperation can also be done by adding a lookup_key function - it would transpose keys from one namespace to another. For example, if module A has a::x and you want to provide that value from module B, then module B could bind to say b::for::a::x, and the function translates the key "a::x" to "b::for::a::x" (or something like that). If this is wanted as some kind of default this lookup key function is placed in the default hierarchy. When doing this, I can imagine that the function would take options to define which keys it would transpose, and to what/which modules. If desired, that function could take a list of modules (defines the precedence) and it could perform merging of the result).

Would those be workable solutions for the described case? If so, no changes would be required to hiera to support this.

Jorie Tappa (JIRA)

unread,
Jan 21, 2020, 4:47:04 PM1/21/20
to puppe...@googlegroups.com

Jorie Tappa (JIRA)

unread,
Jan 21, 2020, 4:47:04 PM1/21/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages