Blocks for what no other block does: calling an existing bundle, or writing CFEngine policy yourself. Custom CFEngine and Call Method explains when and how to use them.

Call Method

Calls a bundle outside this canvas: stdlib, a module, or hand-written CFEngine.

Generates: a methods promise.

Settings

Setting Required Description
Bundle name Yes A bundle that already exists elsewhere — CFEngine’s standard library, a cfbs module, or one you wrote by hand — e.g. “my_bundle” (looked up in the default namespace) or “ns:my_bundle”. Canvas blocks call each other automatically; this isn’t for that.
Arguments No One per line, in the bundle’s parameter order. $(…) passes a variable’s value, @(…) a list.

Example

The policy it generates, for example:

# Run site checks
methods:
  "Run site checks" usebundle => default:site_checks;

Custom CFEngine

Hand-written CFEngine promises, for what no block covers.

Generates: the promises and definitions you write.

Settings

Setting Required Description
Promises Yes Promise sections as in a bundle agent, e.g. files: then its promises. They run as a bundle of their own, in this file’s namespace: write the standard library’s bodies and bundles as default:name.
Bodies and bundles it uses No Any body or bundle the promises call that isn’t in the standard library, e.g. body copy_from mirror(from) { … }.

Example

The policy it generates, for example:

# Mirror the site
methods:
  "Mirror the site" usebundle => mirror_the_site;

# Custom CFEngine "Mirror the site", run as one step of main.
bundle agent mirror_the_site
{
  files:
    "/var/www/site"
      copy_from => mirror("/srv/site"),
      depth_search => default:recurse("inf");
}

# Bodies and bundles of Custom CFEngine "Mirror the site".
body copy_from mirror(from)
{
  source => "$(from)";
  purge => "true";
}