Project

General

Profile

Actions

User story #9057

closed

Allow the use of node properties info in Directive parameters

Added by François ARMAND over 8 years ago. Updated about 8 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 ARMAND2016-09-26Actions
User story #9152: Document node properties usageReleasedFrançois ARMAND2016-09-28Actions
Bug #9161: Correct node properties documentation link in Rudder 3.1ReleasedNicolas CHARLES2016-09-28Actions
Bug #9162: Correct node properties documentation link in Rudder 3.2ReleasedNicolas CHARLES2016-09-28Actions

Related issues 1 (1 open0 closed)

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

Updated by François ARMAND over 8 years ago

(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.

Actions #2

Updated by François ARMAND over 8 years ago

  • Description updated (diff)
Actions #3

Updated by François ARMAND over 8 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/1194
Actions #4

Updated by François ARMAND about 8 years ago

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES
Actions #5

Updated by François ARMAND about 8 years ago

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ
Actions #6

Updated by François ARMAND about 8 years ago

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES
Actions #7

Updated by François ARMAND about 8 years ago

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ
Actions #8

Updated by François ARMAND about 8 years ago

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES
Actions #9

Updated by François ARMAND about 8 years ago

  • Assignee changed from Nicolas CHARLES to Vincent MEMBRÉ
Actions #10

Updated by François ARMAND about 8 years ago

  • Assignee changed from Vincent MEMBRÉ to Nicolas CHARLES
Actions #11

Updated by François ARMAND about 8 years ago

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

Updated by François ARMAND about 8 years ago

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

Updated by Vincent MEMBRÉ about 8 years ago

  • Parent task deleted (#6733)
Actions #14

Updated by Vincent MEMBRÉ about 8 years ago

  • 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: Atom PDF