cfengine/core — pull request #833 by tzz (2013-07-24 07:04:36+00:00)
Title: new lib bundle: feature.cf

Please see `persistent_disable_DAEMON` and `clear_persistent_disable_DAEMON` for prior work in this direction. Also the `abortclasses` facility is related as a on/off toggle.

This bundle will let us (in the core) and our users set and unset features easily. The usage is documented inline, but basically this lets you define a bunch of `feature_set_DURATION_X` and `feature_unset_X` classes at any time, then call the `feature` bundle, and those classes will instruct the bundle to automatically set `X` for `DURATION` minutes or to unset `X`. The `classesmatching` function is used for this.

In other words, it's a general mechanism for toggling arbitrary **features** on or off. For instance you may want to instantly set or unset the knowledge that a machine is disabled, or that it's in a change window, or that it's being moved, or that it's being tested.

The included `feature_test` bundle lets us verify what's on and off; and also lets us test the signaling classes mentioned above. Again, see the inline documentation for usage.