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

getvalues(array[idx]) fails =(

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.9.1
    • Fix Version/s: 3.10.0, 3.9.2
    • Component/s: Evaluation
    • Labels:
      None
    • Environment:
      Linux x64

      Description

      Take the example policy.

      [root@lva1-app1201 Linux]# cat /var/tmp/test.cf 
      
      body common control
      {
      	bundlesequence => {"test_policy_one"};
      }
      
      bundle agent test_policy_one
      {
      vars:
        command_executed::
          "rollup" slist => getindices("test_script_sh.test_array");
          "rollup_values[$(rollup)]" slist => getvalues("test_script_sh.test_array[$(rollup)]");
      
      classes:
          "command_executed" expression => usemodule("../../tmp/test_script.sh", "");
          "rollup_populated" expression => reglist("@(rollup)", ".+");
      
      reports:
        rollup_populated::
          "rollup is $(rollup)";
          "rollup values of $(rollup) is $(rollup_values[$(rollup)])";
      }
      

      Which calls the following module to populate an array.

      [root@lva1-app1201 Linux]# cat /var/tmp/test_script.sh 
      #!/bin/bash
      
      /bin/echo "=test_array[blah]=hi"
      /bin/echo "=test_array[svoboda]=awesome"
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10038 jimis (Dimitrios Apostolou)
                Reporter:
                msvoboda@linkedin.com mike svoboda
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel