Project

General

Profile

Actions

User story #9057

closed

Allow the use of node properties info in Directive parameters

User story #9057: Allow the use of node properties info in Directive parameters

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

Status:
Released
Priority:
1 (highest)
Category:
Web - Config management
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

This is the remaining part of #6733, where we allow user to use node propertise in directives parameters. These node properties will be replaced by their value at generation time, so that they can be used (for example) as input for JS transformation.

The chosen format for ncf technique, as documented in http://www.rudder-project.org/doc-3.1/_using_properties.html, is the following:

${node.properties[datacenter]}

And you can descend into a json structure:

${node.properties[datacenter][europe][france]}

We must use the same in directive, at least for the data access.

Question: do we want to let the possiblity to have in a directive parameter

${node.properties[datacenter]}

to tell "I really want that to be changed at runtime, and not at generation time", and so for node properties that have to be change at generation time, use something like

${rudder.node.properties[datacenter]}

?

Open question 2: what to do if the key sequence does not exists ? (i.e, in the example, [datacenter] is not defined) ? The possible option are:

1/ fails the generation, "missing property blabla in nodes node1, node2, node3
2/ use a default value (empty string, the string "null", etc)
3/ actually returns ${node.properties[datacenter]

The sanest (less surprise, fails early) is clearly 1/, but it certainly can lead to unpleasant case where one node block the whole generation (until rudder is able to generate policies node by node).
2/ and 3/ are variation of the same poison, and WILL lead to unexpected behaviour and surprises (anybody looking for "rm -rf ${prop1}/{prop2}, where neither are defined and so replaced by "" ?). On the other hand, it is much less frustrating when you are in an urge to deploy something and rudder keeps telling that their is 200 nodes with incorrect properties. And for the ncf/technique part of the feature, it's the behaviour (3/ actually, I believe).


Subtasks 4 (0 open4 closed)

Bug #9126: Build error in branch 3.2RejectedFrançois ARMANDActions
User story #9152: Document node properties usageReleasedFrançois ARMANDActions
Bug #9161: Correct node properties documentation link in Rudder 3.1ReleasedNicolas CHARLESActions
Bug #9162: Correct node properties documentation link in Rudder 3.2ReleasedNicolas CHARLESActions

Related issues 1 (1 open0 closed)

Related to Rudder - User story #9158: Normalize ${rudder.parameter} syntaxe between ncf and directiveNewActions

Updated by François ARMAND over 9 years ago Actions #1

(backporting comments from #6733)

Francois:
Personnaly, I don't think it is a good idea to have to almost identical, because it's extremelly surprising (vastly different behaviour for almost the same thing). And a work around can certainly be used by calling the full CFEngine variable name (i.e:
${properties.property__var_rudder_cfengine_community_inputs_properties_d_properties_json[properties][datacenter]} - this one won't be changed at generation time).

Benoit:
I think replace a perfectly regular cfengine variable is also surprising for the user knowing cfengine and knowing how to use it.

A different argument would be that we want to be as much as possible independent of the underlying agent, so things from the user in the interface must be as much as possible processed before being sent to the agent.

Updated by François ARMAND over 9 years ago Actions #2

  • Description updated (diff)

Updated by François ARMAND over 9 years ago Actions #3

  • 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/1194

Updated by François ARMAND over 9 years ago Actions #4

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES

Updated by François ARMAND over 9 years ago Actions #5

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ

Updated by François ARMAND over 9 years ago Actions #6

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES

Updated by François ARMAND over 9 years ago Actions #7

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ

Updated by François ARMAND over 9 years ago Actions #8

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES

Updated by François ARMAND over 9 years ago Actions #9

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ

Updated by François ARMAND over 9 years ago Actions #10

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES

Updated by François ARMAND over 9 years ago Actions #11

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100

Updated by François ARMAND over 9 years ago Actions #12

  • Related to User story #9158: Normalize ${rudder.parameter} syntaxe between ncf and directive added

Updated by Vincent MEMBRÉ over 9 years ago Actions #13

  • Parent task deleted (#6733)

Updated by Vincent MEMBRÉ over 9 years ago Actions #14

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 3.1.15/14 and 3.2.8/7 which were released today.

Actions

Also available in: PDF Atom