FUNCTION NAME

Table of Contents

[%CFEngine_function_prototype(arguments, here)%]

Description: Brief description of function.

Return type: data|int|real|string|(i|r|s)list|class|(i|r)range|

[%CFEngine_function_attributes(arguments, here)%]

Write a detailed description here.

Example:

The whole thing:

[%CFEngine_include_snippet(type.cf)%]

Or, selected sections:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
      "foo"
        data => '{ "bar": true, "baz": [1, 2, 3] }';

      "_foo" string => type("foo", "true");
      "_foobar" string => type("foo[bar]", "false");
      "_foobaz" string => type("foo[baz]", "true");

      "a" string => "hello";
      "b" int => "123";
      "c" rlist => { "1.1", "2.2", "3.3" };

      "_a" string => type("a");
      "_b" string => type("b", "true");
      "_c" string => type("c", "false");

  reports:
      "'foo' is of type '$(_foo)' (detail)";
      "'foo[bar]' is of type '$(_foobar)' (no detail)";
      "'foo[baz]' is of type '$(_foobaz)' (detail)";

      "'a' is of type '$(_a)' (no detail)";
      "'b' is of type '$(_b)' (detail)";
      "'c' is of type '$(_c)' (no detail)";
}

Output:

R: 'foo' is of type 'data object' (detail)
R: 'foo[bar]' is of type 'data' (no detail)
R: 'foo[baz]' is of type 'data array' (detail)
R: 'a' is of type 'string' (no detail)
R: 'b' is of type 'policy int' (detail)
R: 'c' is of type 'rlist' (no detail)

History:

  • Introduced in VERSION
  • Behavior foo added in VERSION