Project

General

Profile

Feature #3309

Support deep merging of hash structures in smart class parameters

Added by Dominic Cleal over 5 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Smart Variables
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
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

Related to Foreman - Feature #3636: Regex support in matcher-values of smart variables and parametersNew2013-11-12
Related to Foreman - Tracker #4470: Usability of parameters and overridesNew

Related to Foreman - Bug #8217: Matchers/overrides have no clear grouping, mess of input boxesClosed2014-10-30
Related to Foreman - Feature #9949: deep merge broken when using facts in hashNew
Related to Foreman - Bug #9672: Smart parameter: merge behavior for yaml parametersNew2015-03-06
Related to Foreman - Feature #10731: Allow matches to merge with default values.Closed2015-06-08

Associated revisions

Revision ea4eec44 (diff)
Added by Ori Rabin over 4 years ago

Fixes #3309 - Support deep merging of hash and array structures in smart class parameters

History

#1 Updated by Dominic Cleal almost 5 years ago

  • Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1010575

#2 Updated by Ohad Levy almost 5 years ago

  • Related to Feature #3636: Regex support in matcher-values of smart variables and parameters added

#3 Updated by Stephen Benjamin almost 5 years ago

  • Related to Tracker #4470: Usability of parameters and overrides added

#4 Updated by Ori Rabin over 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Ori Rabin

#5 Updated by Ori Rabin over 4 years ago

  • Target version set to 1.7.4

#6 Updated by The Foreman Bot over 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1715 added
  • Pull request deleted ()

#7 Updated by Dmitri Dolguikh over 4 years ago

  • Target version changed from 1.7.4 to 1.7.3

#8 Updated by Dominic Cleal over 4 years ago

  • Target version changed from 1.7.3 to 1.7.2

#9 Updated by Marek Hulán over 4 years ago

  • Legacy Backlogs Release (now unused) set to 21

#10 Updated by Ori Rabin over 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#11 Updated by Dominic Cleal over 4 years ago

  • Related to Bug #8217: Matchers/overrides have no clear grouping, mess of input boxes added

#12 Updated by Dominic Cleal about 4 years ago

  • Related to Feature #9949: deep merge broken when using facts in hash added

#13 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #9672: Smart parameter: merge behavior for yaml parameters added

#14 Updated by Dominic Cleal almost 4 years ago

  • Related to Feature #10731: Allow matches to merge with default values. added

Also available in: Atom PDF