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

Class sometimes evaluated as both true and false

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.0
    • Component/s: Parsing
    • Labels:
      None

      Description

      Consider the following script:

      body common control
      {
        bundlesequence => { "test" };
      }
      
      bundle agent test
      {
        classes:
          "found_the_file" expression => fileexists("/bin/bash");
      
        vars:
          found_the_file::
            "myvar" string => execresult("/bin/echo /bin/bash", "noshell");
          !found_the_file::
            "myvar" string => execresult("/bin/echo /bin/ls", "noshell");
      
        reports:
          "$(myvar)";
      }
      

      This reports:

      R: /bin/ls
      R: /bin/bash
      

      IOW, both found_the_file and !found_the_file are evaluated to true, and reports is executed twice, despite containing only one promise.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10042 Nick Anderson
                Reporter:
                a10040 Kristian Amlie
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel