string

Table of Contents

Prototype: string(arg)

Return type: string

Description: Convert arg to string.

Arguments:

  • arg: string, in the range: .*

If arg is a container reference it will be serialized to a string. The reference must be indicated with @(some_container). Strings are not interpreted as references.

Example:

bundle agent main
{
  classes:
      "classA";
      "classB";

  vars:
      "some_string" string => "cba";
      "class_expressions" slist => {"classA.classB",
                                    string(and("classA", strcmp("$(some_string)", "abc")))
      };

  reports:
      "$(class_expressions)";
}
R: classA.classB
R: !any

This policy can be found in /var/cfengine/share/doc/examples/string.cf and downloaded directly from github.

See also: int()

History:

  • Introduced in 3.18.0