Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3165

Note that functions can return data

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: 3.10.6, 3.12.2, 3.15.0b1
    • Fix Version/s: 3.12.3, 3.15.0
    • Component/s: Documentation
    • Labels:
      None

      Description

      Currently, the docs indicate that function can return scalar and list values.

      In reference/functions.markdown

      They can return scalar and list values:

      ```cf3
          vars:
      bundle agent main
      {
        vars:
            "random" int => randomint("0", "100");
            "say" string => canonify("message,with:weird characters");
            "list" slist => readstringlist("/tmp/listofstring", "#.*", "\s", 10, 400);
      }
      ```
      

      So:

      They can return scalar (string|int|float|bool), list, and data values:

      ```cf3
          vars:
      bundle agent main
      {
        vars:
            "random" int => randomint("0", "100");
            "say" string => canonify("message,with:weird characters");
            "list" slist => readstringlist("/tmp/listofstring", "#.*", "\s", 10, 400);
            "data" data => variablesmatching_as_data ( ".*" );
      }
      ```
      

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel