Modular cfengine_stdlib.cf

Posted by Mahesh Kumar
July 5, 2013

After work and discussion, the CFEngine developer team produced https://github.com/cfengine/core/pull/784 to make libraries/cfengine_stdlib.cf compatible with 3.4.x and older again, to modularize it, and to improve the upgrade experience. These changes will be in the upcoming CFEngine 3.5.1 release:

  • libraries/cfengine_stdlib.cf is now 3.4-compatible again, so upgrading will not break existing CFEngine installations.
  • lib/3.5 and lib/3.6 contain the standard library with changes that require 3.5.x and 3.6.x, respectively
  • lib/3.5 and lib/3.6 have multiple files instead of a single cfengine_stdlib.cf. This is the same content as the cfengine_stdlib.cf content, but split by promise type (e.g. lib/3.5/files.cf has file-related bodies and bundles).
  • common.cf has promise bodies common to all promises, e.g. action and classes
  • paths.cf has a utility common bundle called paths that lets you say, for instance, “$(paths.path[rpm])” instead of hard-coding the location of the RPM manager executable.
  • 3.5.1 and newer will have new variables to store the CFEngine major, minor, and patch version separately.

It all works just like before 3.5.0, except you don’t have to include a huge library. If you just want to set classes for a promise, include common.cf. If you just want process filters, include processes.cf.

promises.cf has been modified in 3.5.1 to include these new libraries, so by default in 3.5.1 you will still have all the bodies you know so well. That way, upgrading will not suddenly break your policies.