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

Functions to determine if the current version of cfengine is newer/older than a specific version

    XMLWordPrintable

    Details

    • Story Points:
      1

      Description

      In policy, sometimes I need to target specific versions of CFEngine (usually for working around bugs, or integrating features that were backported). I can use the if minimum_version macro to prevent a section of policy from parsing, and that is frequently enough for my needs, but it would be convenient if I could define classes based on the current version being newer, older or in-between some versions of cfengine without having to resort to a very long explicit class expression.

      bundle agent main
      {
        reports:
      
          "Between cfengine 3.12.1 and 3.13.1"
            if => "(cfengine_3_12.!cfengine_3_12_0)|cfengine_3_13_0|cfengine_3_31_1";
      
          "Concisely between cfengine 3.12.1 and 3.13.1"
            if => cf_version_between( "3.12.1", "3.13.1", inclusive);
      
      
           "Older than 3.12.1"
            if => cf_version_older_than( "3.12.1" );
      
            "Newer than 3.12.2"
            if => cf_version_newer_than( "3.12.2" );
      
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                karlhto Karl Hole Totland
                Reporter:
                a10042 Nick Anderson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel