Bug #18466
closedInherited node prop arrays are replaced not merged contrary to doc
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" }
Updated by François ARMAND about 4 years ago
I will at least correct the documentation quickly.
It doesn't seems there's any simple way to change behavior, it's hardcoded in typesafe config lib.
Updated by François ARMAND about 4 years ago
I can correct the behavior, but only at first level (ie if the root value is an array) which may be even more surprising than a consistant, never replace solution.
Updated by François ARMAND about 4 years ago
- Status changed from New to In progress
- Assignee set to François ARMAND
Updated by François ARMAND about 4 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Vincent MEMBRÉ
- Pull Request set to https://github.com/Normation/rudder/pull/3319
Updated by François ARMAND about 4 years ago
- Pull Request changed from https://github.com/Normation/rudder/pull/3319 to https://github.com/Normation/rudder/pull/3335
Updated by François ARMAND about 4 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|3f145484a35e18551787b7a24c1504026af1856b.
Updated by François ARMAND about 4 years ago
- Related to User story #18537: Update documentation about node properties value inheritance rules added
Updated by François ARMAND about 4 years ago
- Related to User story #16347: Group properties added
Updated by François ARMAND about 4 years ago
- Target version changed from 6.1.7 to 6.2.0~rc1
Updated by François ARMAND about 4 years ago
- Fix check changed from To do to Error - Blocking
This does not seems to work: string and arrays are overridden even if we choose `maa` case.
Updated by François ARMAND about 4 years ago
- Related to Bug #18577: Global parameter inheritMode is not used to display merged node property value in UI added
Updated by François ARMAND about 4 years ago
- Related to Bug #18580: String node properties display quotes added
Updated by François ARMAND about 4 years ago
- Fix check changed from Error - Blocking to Checked
Updated by Vincent MEMBRÉ about 4 years ago
This bug has been fixed in Rudder 6.2.0~rc1 which was released today.
Updated by Vincent MEMBRÉ about 4 years ago
- Related to Bug #18467: Correct documentation about arrray merge for node properties added
Updated by Vincent MEMBRÉ about 4 years ago
- Status changed from Pending release to Released