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

Function mergedata falsely logs errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0
    • Component/s: Logging
    • Labels:
      None

      Description

      I tested this policy using CFEngine Community 3.6.0b1, and on a build from the master branch:

      <pre>
      body common control
      {
      bundlesequence =>

      { main }

      ;
      }

      bundle agent main
      {
      }

      bundle agent test
      {
      vars:
      "json" string => '

      { "x": "lhs" }

      ';

      1. "lhs" data => parsejson(' { "x": "lhs" }

        ');
        "lhs" data => parsejson("$(json)");
        "rhs" data => parsejson('

        { "y": "rhs" }

        ');

      "result" data => mergedata("lhs", "rhs");

      reports:
      "result[x]: $(result[x])";
      "result[y]: $(result[y])";
      }
      </pre>

      When the test bundle is excecuted, @result@ has the correct merged data. However, whether or not it is executed, the following errors are logged:

      <pre>
      2014-02-05T13:55:02-0500 info: /default/cfe_internal_update: Updated '/var/cfengine/inputs/promises.cf' from source '/var/cfengine/masterfiles/promises.cf' on 'localhost'
      2014-02-05T13:55:02-0500 info: /default/cfe_internal_update: Purging '/var/cfengine/inputs/promises.cf.cfsaved' in copy dest directory
      2014-02-05T13:55:02-0500 error: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: /default/test: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: /default/test: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: /default/test: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: mergedata: argument 'lhs' does not resolve to a container or a list
      2014-02-05T13:55:02-0500 error: /default/test: mergedata: argument 'lhs' does not resolve to a container or a list
      </pre>

      When the expectedly equivalent variable promise I commented out is used instead, there are no errors logged.

      In @core/libpromises/evalfunction.c@, I changed the log statement in @FnCallMergeData@ from

      <pre>
      Log(LOG_LEVEL_ERR, "%s: argument '%s' is not a variable reference", fp->name, RlistScalarValue(arg));
      </pre>

      to

      <pre>
      Log(LOG_LEVEL_VERBOSE, "%s: argument '%s' is not a variable reference", fp->name, RlistScalarValue(arg));
      </pre>

      And after I built it the errors are not logged anymore, although I don't see the messages when running cf-agent with the @-v@ flag either. I'm not sure how I can create an acceptance test for this, but I'm listening if required.

        Attachments

          Activity

            People

            • Assignee:
              a10025 Volker Hilsheimer (Inactive)
              Reporter:
              Ed Ed I (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel