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

Variables with the same name from calling/parent bundle are collected by mergedata()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: To Do
    • Priority: Higher
    • Resolution: Unresolved
    • Affects Version/s: 3.10.0, 3.9.1
    • Fix Version/s: None
    • Component/s: Built-in functions
    • Labels:
      None
    • Environment:
      checked in freebsd 11 and oracle linux 7.1
    • Story Points:
      3

      Description

      This ticket was created from forum https://groups.google.com/d/topic/help-cfengine/m6xK5n5c_8k/discussion :

      I widely use collecting data from native one dimension arrays like:

      "merged_data_vars" data => mergedata('{ "vars1": vars1 }');
      

      where vars1 is one dimension array.

      Please, run code in attach (unit_test_merged.cf). Then:

      Behavior in 3.7.3 (expected result):

      [root@]# cf-agent -I -K -f unit_test_merged.cf
      R: test_merged_low : merged_data_vars_str : {
        "vars1": {
          "c": "string c"
        }
      }
      

      Behavior in 3.10 (wrong result):

      root@]$ cf-agent -I -K -f unit_test_merged.cf
      R: test_merged_low : merged_data_vars_str : {
        "vars1": {
          "a": "string a",
          "b": "string b",
          "c": "string c"
        }
      }
      

      So, in 3.10 we can see collected data from var1 array members defined in upper bundle. Maybe it's related to well known issue concerned to unclean variables in preevaluate stage.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              igorg Igor Goncharenko
            • Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel