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

List references in methods not expanded when they depend on a variable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Higher
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Story Points:
      5
    • Platform:
      Debian, Linux, Any
    • Found in version (details):
      3.15.0

      Description

      This issue is discussed in this thread in the help-cfengine mailing list.

      It appears that list references passed in methods promises are not expanded correctly when they depend on a variable.

      The four methods calls in the attached test bundle are supposed to return the same results, except for the order in which the values in the lists are printed out (depending on the lists generated by getindices).

      What happens is that when executor is called directly, the reference to the list, which contains a variable, is passed as is to the bundle, and the bundle can't make sense of it. Only when the referenced list is expanded into a simple list in one of the launcher bundles and then passed to executor the correct values are reported.

      This is the output I get on a Debian 10:

      root@cfengine-server:/home/admin# cf-agent -KI -f ./test.cf -C
      R: [test_data:run_list:executor] a
      R: [test_data:run_list:executor] b
      R: [test_data:run_list:executor] c
      R: [test_data:run_list:executor] x
      R: [test_data:run_list:executor] y
      R: [test_data:run_list:executor] z
      R: [test_array:run_list:executor] x
      R: [test_array:run_list:executor] y
      R: [test_array:run_list:executor] z
      R: [test_array:run_list:executor] a
      R: [test_array:run_list:executor] b
      R: [test_array:run_list:executor] c
         error: List or container parameter 'main.data[${datakey}][list]' not found while constructing scope 'executor' - use @(scope.variable) in calling reference
      R: [test_executor_data:executor] @{main.data[${datakey}][list]}
         error: List or container parameter 'main.data[${arraykey}][list]' not found while constructing scope 'executor' - use @(scope.variable) in calling reference
      R: [test_executor_array:executor] @{main.data[${arraykey}][list]}
      root@cfengine-server:/home/admin#  

       

        Attachments

        1. json_flatten.cf
          0.8 kB
        2. test.cf
          3 kB

          Issue Links

            Activity

              People

              • Assignee:
                vpodzime Vratislav Podzimek
                Reporter:
                bronto Marco Marongiu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Summary Panel