Table of Contents
The Techniques use the StringTemplate engine. A Technique must have the .st extension to be extended by Rudder (have some variables replaced, some part removed or added given some parameters).
Note : Rudder use a StringTemplate grammar slighlty different from the default one. Rather than using "$" as a variable identifier, the Techniques use "&" to avoid collision with the CFEngine variables
&DNS_RESOLVERS: { "&it&" };separator=", "&
-
Will be remplaced by
"8.8.8.8", "8.8.4.4"
-
Here,
&it&
is an alias for the current item in the list (with no confusion, because there is only one variable)
&POLICYCHILDREN, CHILDRENID : {host, uuid | "/var/rudder/share/&uuid&/" maproot => { host2ip("&host&"), escape("&host&") }, admit => { host2ip("&host&"), escape("&host&") }; } &
-
host
is an alias for the current value of POLICYCHILDREN -
uuid
is an alias for the current value of CHILDRENID - Both item are iterated at the same time, so both list must have the same length
&FILE_AND_FOLDER_MANAGEMENT_PATH:{path |"file[&i&][path]" string => "&path&"; }&
- i is an iterator, starting at 1
The result would be:
"file[1][path]" string => "/var"; "file[2][path]" string => "/bin";
&if(INITIAL)& something &endif&
The variable must either be:
- A boolean: If its value is true, then the section will be displayed
-
A variable with the parameter
MAYBEEMPTY="true"
: If the value is not set, then the section won’t be displayed, otherwise it will be displayed
More information can be found here: https://theantlrguy.atlassian.net/wiki/display/ST/ST+condensed+--+Templates+and+expressions
As of Rudder 4.3, Techniques with separated policy generation (see tag POLICYGENERATION in metadata.xml) need to have a way to identify uniquely their generated files, and bundles and methods. The special placeholder RudderUniqueID is replaced at generation by the identifier of the Directive. It can be used anywhere in the .st files, or even in the OUTPATH.