Project

General

Profile

« Previous | Next » 

Revision 9498f502

Added by Nicolas CHARLES over 6 years ago

Fixes #11618: Node properties local override

View differences:

techniques/system/common/1.0/properties.cf
# Read node properties and put them into the node namespace
#
# Properties are available using the node.namespace container that contains the values
# Those values are read from /var/rudder/cfengine-community/properties/*.json
# All files are taken in order and overrides the previous one, the last one wins.
# Those values are read from /var/rudder/cfengine-community/inputs/properties.d/*.json and from
# /var/rudder/local/properties.d/*.json
# All files are taken in order and overrides the previous one, the last one wins, with the local
# defined properties overriding the one in /var/rudder/cfengine-community/inputs/properties/
#
# Each file must contain at least a 2 levels JSON content, the first level is the namespace level
# and the second level is the key level.
......
# The files to read
"properties_files" slist => findfiles("${this.promise_dirname}/../../properties.d/*.json");
# Local properties files
"local_properties_files" slist => findfiles("/var/rudder/local/properties.d/*.json");
# The sorted file list
"_sorted_files" slist => sort("properties_files", "lex");
# The sorted local file list
"_sorted_local_files" slist => sort("local_properties_files", "lex");
# cfengine iterates over lists in promises in the reverse order, so we need the inverted list
"sorted_files" slist => reverse("_sorted_files");
"sorted_files" slist => { @{_sorted_files}, @{_sorted_local_files} },
policy => "ifdefined";
# Canonified sorted file list
"file_id[${sorted_files}]" string => canonify("${sorted_files}");

Also available in: Unified diff