Project

General

Profile

Actions

Feature #3309

closed

Support deep merging of hash structures in smart class parameters

Added by Dominic Cleal over 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When storing complex hashes in smart variables/class parameters (i.e. JSON/YAML), the matchers simply override previous values with a certain precedence order.

Instead, we want to be able to deep merge data across the matchers, so a hash can be built up with a culmination of data.

Steps to Reproduce:
1. set a parameter/variable matcher order to "fqdn", "hostgroup", set data type to JSON
2. add an override of "hostgroup=Example" (change as appropriate), value: {"example":{"foo":"bar"}}
3. add an override of "fqdn=foo.example.com" (change), value: {"example":{"bar":"baz"}}
4. check YAML output on foo.example.com's host page

Actual results:
example:
bar: baz

Expected results:
example:
foo: bar
bar: baz

We should probably do the same for arrays too, e.g.

admin_users = []

hostgroup = [user1, user2]
location = [user3, user4]

admin users = [user(1..4)]


Related issues 6 (4 open2 closed)

Related to Foreman - Feature #3636: Regex support in matcher-values of smart variables and parametersNew11/12/2013Actions
Related to Foreman - Tracker #4470: Usability of parameters and overridesNew

Actions
Related to Foreman - Bug #8217: Matchers/overrides have no clear grouping, mess of input boxesClosedOri Rabin10/30/2014Actions
Related to Foreman - Feature #9949: deep merge broken when using facts in hashNewActions
Related to Foreman - Bug #9672: Smart parameter: merge behavior for yaml parametersNew03/06/2015Actions
Related to Foreman - Feature #10731: Allow matches to merge with default values.ClosedOri Rabin06/08/2015Actions
Actions

Also available in: Atom PDF