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

Function to expained variables in a container to another container

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.0
    • Component/s: Built-in functions
    • Labels:
      None

      Description

      In EFL the input paramaters can contain variables. Currently I have to expand the vars by dereferencing into an array. I would prefer to keep this data as a container. Since containers are read only, a function to do the expansion to another container would be welcome.

      <pre>

      1. How I do it now:
      2. parse_${param_file}_as_json::
        "json_data"
        comment => "Parse json file",
        ifvarclass => "parse_${param_file}_as_json" ,
        data => readjson( "${ref}", "${efl_c.max_bytes}" );

      "i"
      comment => "Index data",
      ifvarclass => "parse_${param_file}_as_json",
      slist => getindices( "json_data" );

      "d[${i}][${params[${p}]}]"
      comment => "Make final data set and deal with bug 2333",
      ifvarclass => "parse_${param_file}_as_json",
      string => "${json_data[${i}][${params[${p}]}]}";

      1. a better way:
        "json_data"
        comment => "Parse json file",
        ifvarclass => "parse_${param_file}_as_json" ,
        data => readjson( "${ref}", "${efl_c.max_bytes}" );

      "d" data => expand_data( "json_data" );
      </pre>

        Attachments

          Activity

            People

            Assignee:
            a10040 Kristian Amlie
            Reporter:
            neilhwatson Neil Watson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: