Project

General

Profile

Actions

Bug #18466

closed

Inherited node prop arrays are replaced not merged contrary to doc

Added by François ARMAND about 4 years ago. Updated almost 4 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 #1

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.

Actions #2

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.

Actions #3

Updated by François ARMAND about 4 years ago

  • Status changed from New to In progress
  • Assignee set to François ARMAND
Actions #4

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
Actions #5

Updated by François ARMAND about 4 years ago

  • Description updated (diff)
Actions #6

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
Actions #7

Updated by François ARMAND about 4 years ago

  • Status changed from Pending technical review to Pending release
Actions #8

Updated by François ARMAND about 4 years ago

  • Related to User story #18537: Update documentation about node properties value inheritance rules added
Actions #9

Updated by François ARMAND about 4 years ago

Actions #10

Updated by François ARMAND about 4 years ago

  • Target version changed from 6.1.7 to 6.2.0~rc1
Actions #11

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.

Actions #12

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
Actions #13

Updated by François ARMAND about 4 years ago

  • Related to Bug #18580: String node properties display quotes added
Actions #14

Updated by François ARMAND about 4 years ago

  • Fix check changed from Error - Blocking to Checked
Actions #15

Updated by Vincent MEMBRÉ almost 4 years ago

This bug has been fixed in Rudder 6.2.0~rc1 which was released today.

Actions #16

Updated by Vincent MEMBRÉ almost 4 years ago

  • Related to Bug #18467: Correct documentation about arrray merge for node properties added
Actions #17

Updated by Vincent MEMBRÉ almost 4 years ago

  • Status changed from Pending release to Released
Actions

Also available in: Atom PDF