Variable


variable_dict

Define a variable that contains key,value pairs (a dictionnary)

Compatible with nodes running Rudder 2.11 or higher.

Usage

To use the generated variable, you must use the form ${variable_prefix.variable_name[key]} with each name replaced with the parameters of this method.

Be careful that using a global variable can lead to unpredictable content in case of multiple definition, which is implicitly the case when a technique has more than one instance (directive). Please note that only global variables are available within templates.

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • value: The variable content in JSON format

Classes defined

variable_dict_${variable_name}_{kept, repaired, not_ok, reached}


variable_dict_from_file

Define a variable that contains key,value pairs (a dictionnary) from a JSON file

Compatible with nodes running Rudder 2.11 or higher.

Usage

To use the generated variable, you must use the form ${variable_prefix.variable_name[key]} with each name replaced with the parameters of this method.

Be careful that using a global variable can lead to unpredictable content in case of multiple definition, which is implicitly the case when a technique has more than one instance (directive). Please note that only global variables are available within templates.

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • file_name: The file name with JSON content

Classes defined

variable_dict_from_file_${variable_name}_{kept, repaired, not_ok, reached}


variable_iterator

Define a variable that will be automatically iterated over

Compatible with nodes running Rudder 2.11 or higher.

Usage

The generated variable is a special variable (slist in cfengine speaking) that is automatically iterated over. When you call a generic method with this variable as a parameter, n calls will be made, one for each items of the variable. Note: there is a limit of 10000 items

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • value: The variable content
  • separator: Regular expression that is used to split the value into items ( usually: , )

Classes defined

variable_iterator_${variable_name}_{kept, repaired, not_ok, reached}


variable_iterator_from_file

Define a variable that will be automatically iterated over

Compatible with nodes running Rudder 2.11 or higher.

Usage

The generated variable is a special variable (slist in cfengine speaking) that is automatically iterated over. When you call a generic method with this variable as a parameter, n calls will be made, one for each items of the variable. Note: there is a limit of 10000 items Note: empty items are ignored

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • file_name: The path to the file
  • separator_regex: Regular expression that is used to split the value into items ( usually: )
  • comments_regex: Regular expression that is used to remove comments ( usually: #.*?(?=) )

Classes defined

variable_iterator_from_file_${variable_name}_{kept, repaired, not_ok, reached}


variable_string

Define a variable from a string parameter

Compatible with nodes running Rudder 2.11 or higher.

Usage

To use the generated variable, you must use the form ${variable_prefix.variable_name} with each name replaced with the parameters of this method.

Be careful that using a global variable can lead to unpredictable content in case of multiple definition, which is implicitly the case when a technique has more than one instance (directive). Please note that only global variables are available within templates.

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • value: The variable content

Classes defined

variable_string_${variable_name}_{kept, repaired, not_ok, reached}


variable_string_from_file

Define a variable from a file content

Compatible with nodes running Rudder 2.11 or higher.

Usage

To use the generated variable, you must use the form ${variable_prefix.variable_name} with each name replaced with the parameters of this method.

Parameters

  • variable_prefix: The prefix of the variable name
  • variable_name: The variable to define, the full name will be variable_prefix.variable_name
  • file_name: The path of the file

Classes defined

variable_string_from_file_${variable_name}_{kept, repaired, not_ok, reached}