Project

General

Profile

Bug #11963

Please, legitimate "Priority" usage in multi-instance directives

Added by Dmitry Svyatogorov 8 months ago. Updated 7 months ago.

Status:
Released
Priority:
N/A
Category:
Documentation
Target version:
Target version (plugin):
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Priority:
32

Description

Please note, that https://www.rudder-project.org/doc-4.2/_directives_ordering.html is in fact incomplete.

https://www.mauras.ch/rudder-fun-with-variables.html
is exploiting undocumented fact that "Priority" field takes precedence over alpha-numeric naming order.
It's really useful together with generic_variable_definition, allowing us to make multilevel overriding (like Chef does).

It works because vars in generic_variable_definition are just internal objects, and redeclaration is ok in cfengine.

Example:

bundle common generic_variable_definition
{

  vars:
    "SECURITY_ACCESS_CONF" string => "admins",
            policy => "overridable";

…
    "SECURITY_ACCESS_CONF" string => "admins,etc",
            policy => "overridable";
…

will set generic_variable_definition.SECURITY_ACCESS_CONF = "admins,etc".

Just use another directive with higher "Priority" (0>1>…>10). And last one will be used.

  • M.b. it works with other directives, but (in general) is useless in management of external objects.
    Per contra, it's very useful to override internal declarations, providing scalar priority instead of 2-level name-sorting hell.

It's also a good workaround against single-level group hierarchy.


Subtasks

Architecture #12007: Enforce with a test the behaviour of generic_variable_definitionReleasedNicolas CHARLES

Associated revisions

Revision c54c1493 (diff)
Added by François ARMAND 8 months ago

Fixes #11963: Please, legitimate \"Priority\" usage in multi-instance directives

History

#1 Updated by Benoît PECCATTE 8 months ago

  • Assignee set to François ARMAND
  • Target version set to 4.1.10
  • Severity set to Minor - inconvenience | misleading | easy workaround
  • User visibility set to Operational - other Techniques | Technique editor | Rudder settings
  • Priority changed from 0 to 32

#2 Updated by François ARMAND 8 months ago

The semantic is now checked with an unit test so that it does not change. I will update documentation to match reality.

#3 Updated by François ARMAND 8 months ago

  • Status changed from New to In progress

#4 Updated by François ARMAND 8 months ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Nicolas CHARLES
  • Pull Request set to https://github.com/Normation/rudder-doc/pull/391

#5 Updated by Normation Quality Assistant 8 months ago

  • Assignee changed from Nicolas CHARLES to François ARMAND

#6 Updated by François ARMAND 8 months ago

  • Status changed from Pending technical review to Pending release

#7 Updated by Vincent MEMBRÉ 7 months ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.1.10 and 4.2.4 which were released today.

Also available in: Atom PDF