Project

General

Profile

Actions

Bug #18466

closed

Inherited node prop arrays are replaced not merged contrary to doc

Added by François ARMAND over 3 years ago. Updated over 3 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:

Description

If you have a global parameter or a group property which is an array, and the node property also defined an array, then the node property array override the parent one in place of appending it, contrary to doc here: https://docs.rudder.io/reference/6.1/usage/variables.html#_node_properties

It seems that the most common use case is appending, not overriding, see: https://gitter.im/normation/rudder?at=5fa075ebdc70b5159aea489b

In the best case, we should let user specify what they want with some syntaxe. Or change the default. Or change the documentation.

EDIT: I proposed a more flexible solution where you can specify what merge behavior you choose for Object, Array and String.
The option is like a regex modifier. It is composed of three chars in a (? and ):
- first char is one of m (merge: default), o (override): behavior for objects,
- second char is one of o) (override: default), a (append), p (prepend): behavior for arrays
- third char is one of o) (override: default), a (append), p (prepend): behavior for strings.

When unspecified, inheritance behavior is (?moo), i.e: Merge object, override arrays and strings (current behavior).

So if an inheritance modifier, it is applied to all children until redefined.
Ex: GlobalParam:

(?mao){"a": [1, 2], "s": "a", "x":"x" }

Node param

(?mao){"a": [3, 4], "s": "b", "y":"y" }

Will result in:

(?mao){"a": [1, 2, 3, 4], "s": "b", "x":"x", "y":"y" }


Related issues 5 (0 open5 closed)

Related to Rudder - User story #18537: Update documentation about node properties value inheritance rules ReleasedAlexis MoussetActions
Related to Rudder - User story #16347: Group propertiesReleasedNicolas CHARLESActions
Related to Rudder - Bug #18577: Global parameter inheritMode is not used to display merged node property value in UIResolvedFrançois ARMANDActions
Related to Rudder - Bug #18580: String node properties display quotesReleasedVincent MEMBRÉActions
Related to Rudder - Bug #18467: Correct documentation about arrray merge for node propertiesReleasedVincent MEMBRÉActions
Actions

Also available in: Atom PDF