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

cf_null appears in expanded mustache template when using data containers, slists and difference

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: 3.6.6
    • Fix Version/s: 3.11.0, 3.10.3
    • Component/s: None
    • Labels:
      None
    • Platform:
      Debian
    • Steps to reproduce:
      Manual steps provided

      Description

      I can do some more background to see if this happens if you don't start with a json data container, but this is my use case fwiw.
      I also need to confirm it is still happening in 3.6.6

      body common control
      {
           bundlesequence => { "diff_bug", };
      }
      
      bundle agent diff_bug
      {
          vars:
          "jsondata" data => parsejson('{ "key" : ["one", "two", "three"]}');
          "noninstersecting_list" slist => { "four" };
          "list" slist => getvalues("jsondata[key]");
          "diff_list" slist => difference("list", "noninstersecting_list");
      
          files:
          "/tmp/bug_output"
          create => "true",
          template_method => "mustache",
          edit_template => "/tmp/bug_output.mustache";
      
          reports:
          "$(diff_list)";
      }
      

      mustache template

      {{#vars.diff_bug.diff_list}}{{.}}
      {{/vars.diff_bug.diff_list}}
      

      OUTPUT

      cf_null
      one
      two
      three
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10042 Nick Anderson
                Reporter:
                martingehrke Martin Gehrke
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel