Node Director
|
At some places in the Director configuration and within LDAP objects the use of expressions rather than mere strings is allowed. Expressions are strings with the possibility to use variable references expanding to the contents of some entities (most of the time the values of attributes of an LDAP object) and to manipulate this contents with modifiers.
Each expression is composed of parts with a static character string and variable references as in the following example:
In the above case "This is " and "in order to " are static parts of the expression, while "${variable1} and ${variable2} are references to two variables.
Each variable reference is always like
The optional modifier part describes an operation that should be performed to the value of variable before including the results in the result string. The result of the modifier itself may be modified, thus
and so on is a valid expression.
Modifiers may accept arguments. Arguments are passed like in
Besides the set of context specific variables, the expression expander itself defines a few variables with specific semantics:
(${} or ${:modifier)) expands to an empty string. This is often used together with modifiers that are not requiring any input string.
expands to the whole string on the left side of this variable reference.
marks the beginning of a section (see below). The contents of $( is the empty string.
marks the end of a section. Expands to the whole text between the corresponding section begin mark $( and the current position. Example: "Some text.$( Value: ${testvar}${):ifdef.testvar}" expands to "Some text." if testvar is not set, otherwise to "Some text. Value: $testvar".
returns the input string in lowercase letters
returns the input string in uppercase letters
searches the user objects in the directory and returns a free uid within a given range. Finduid accepts two arguments: the first being the lower, the second being the higher limit of the uid range (defaults to 1000 and 5000).
searches the group objects in the directory and returns a free gid within a given range. Findgid accepts two arguments: the first being the lower, the second being the higher limit of the gid range (defaults to 1000 and 5000).
extracts a substring from the input string. Substr accepts two arguments, the first being the position (starting from 0) in the string where the substring starts, the second being the length of the substring. The start position defaults to 0, the length to the length of the entire input string. Using out-of-bounds start position or length will result in some reasonable behaviour (empty result if start position is beyond string length, truncation if length is to high).
interprets the input string as an integer number and multiplies it by the multiplier.
interprets the input string as an integer number and divides it by the divisor.
interprets the input string as an integer number and adds the summand.
interprets the input string as an integer number and subtracts the subtrahend.
returns the name of the configured master host.
returns the name of one host that is a member of the host class with the given name.
expects the input string to be a login name, checks if this login name is used and builds an unused login name by adding a number to the input string if necessary.
Starting characters of each word.
translates non-ASCII characters in the input string into a corresponding ASCII representation (i.e. removes accents). Be warned, however, that this is not complete and only few replacements are known to asciify - other non-ASCII characters are just dropped.
runs a shell command (cmd plus optional args), passes the input string down via its standard input and reads the result from its standard output.
if the input string is non-empty, the result string is arg1, otherwise arg2. Missing arg1/arg2 are treated as empty strings.
if the variable with the name in arg1 is defined, the result is the input, otherwise an empty string. This is especially useful with the $( and $) special variables.
interpretes the input string as an integer figure specifying a byte size and converts it into a human readable form
encodes special characters in the value by their XML escape sequence.
if value is empty, then arg1 is taken as the new value
generate a random local domain MAC address. Value is supposed to be the host name, the same host name generates the same MAC during the same session. An empty value generates an empty MAC address.
current date and time
ticketid generate a unique issue tracking id