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

getvalues should return an empty list when run against an empty data container (like getindices does)

    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: None
    • Labels:
      None
    • Found in version (details):
      3.9.1

      Description

      When getindices or getvalues is run against an empty data container they should return similar results. Currently when getindices runs against an empty data container an empty list is defined. However when getvalues is run against an empty data container no variable is created.

      bundle agent main
      {
        vars:
          "data" data => mergedata("def.does_not_exist");
          "a" slist => getindices(data);
          "b" slist => getvalues(data);
      
        classes:"DEBUG";
      
        reports:
          DEBUG::
          "a is variable"
            if => isvariable(a);
          "b is variable"
            if => isvariable(b);
          "getindices and getvalues do not behave similarly when run against an empty data container."
            if => not(and(isvariable(a), isvariable(b)));
      
          any::
          "CFEngine version: $(sys.cf_version)";
          "Pass $(this.promise_filename)"
            if => and(isvariable(a), isvariable(b));
          "FAIL $(this.promise_filename)"
            if => not(and(isvariable(a), isvariable(b)));
      }
      

      Running on 3.9.1

      R: a is variable
      R: getindices and getvalues do not behave similarly when run against an empty data container.
      R: CFEngine version: 3.9.1
      R: FAIL /home/nickanderson/org/cfengine3-3437yNV
      

      Running on 3.7.4

      R: a is variable
      R: b is variable
      R: CFEngine version: 3.7.4
      R: Pass /tmp/./t.cf
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10038 jimis (Dimitrios Apostolou)
                Reporter:
                a10042 Nick Anderson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel