Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created January 20, 2023 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickanderson/40a5e3d63bfd69870d6f36054f11753f to your computer and use it in GitHub Desktop.
Save nickanderson/40a5e3d63bfd69870d6f36054f11753f to your computer and use it in GitHub Desktop.
Simple example showing CFEngine namespaces
bundle agent __main__
{
   methods:
    "" usebundle => my_bundle("first");
    "" usebundle => default:my_bundle("second");
    "" usebundle => nickanderson:my_bundle("third");
}
bundle agent my_bundle(input)
{
  reports:
    "Hello from $(this.namespace):$(this.bundle). I got $(input)";
}
body file control
{
    namespace => "nickanderson";
}
bundle agent my_bundle(input)
{
  reports:
    "Goodbye from $(this.namespace):$(this.bundle). I got $(input)";
}
R: Hello from default:my_bundle. I got first
R: Hello from default:my_bundle. I got second
R: Goodbye from nickanderson:my_bundle. I got third
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment