The agents of cfengine 3
A generic agent can do some preprocessing of promise rules. This includes ordering
and suppressing, or deleting rules. It also includes expanding parameterized
rules and looking for broken promises.
In order to process promises in an approximately optimal order, we must take into
account several things:
- Natural ordering within a bundle: interfaces, files, processes,
- Parameterization and list expansion of bundles using variables and occurrences in the bundle list
- Precondition precedence: rules that rely on other rules must come after them.
- Class context: when are bundles, promises and attributes defined.
All this ends up being summarized by a sorted operational "playlist".
We start with the bundlesequence from the "common control" body and make a list
of these promises, placing any promises with "classes =>" bodies at the head so
that they will precede any occurrences of rules that come later.
Dependencies can occur in classes and variables:
vars and classes defined by modules/processes
outcome context/classes from actions
Variable from context XXX was used in context YYY but XXX does not precede YYY in the bundlesequence.
Class used in context XXX but cannot be defined