Common Traps and Pitfalls

From Cfwiki

Jump to: navigation, search

Not using the any:: class

Everything will work fine for a while. At some point, though, you'll decide you need to put in a class above the implicit any:: section and things will break. You'll cast about in despair, searching for an answer. What has happened is that your implicit any:: section has been consumed by the last explicitly-specified section; the implicit any:: is no longer valid. See the Explicit Definition of the any Class in the Cfengine Style Guide, for more details.

Not matching the entire line (in EditFiles)

The matching algorithm in many (or all) of the commands in the EditFiles section requires that the entire line be matched with the given regular expression. The trap comes when one attempts to match only a portion of the text file line. So, instead of matching a line like:

"ttyS0"

one must use a match such as:

"^ttyS0.*"
Personal tools