Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created October 22, 2019 19:35
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/0bbd1dbfaa82453f083cf8965b19f7ec to your computer and use it in GitHub Desktop.
Save nickanderson/0bbd1dbfaa82453f083cf8965b19f7ec to your computer and use it in GitHub Desktop.

Example showing iteration and variable class guards

Created From: ~/Northern.Tech/CFEngine/cfengine-enterprise-demo/def.json
bundle agent main
{
    vars:
      "iter" slist => { "one", "two", "three" };

   reports:
     "$(iter)"::
       "Variable class guard for $(iter)";

     any::
       "if class guard for $(iter)" if => "$(iter)";
}
# cf-agent --define one,three --no-lock --log-level info --file /home/nickanderson/org/cfengine3-76QqXV
R: Variable class guard for one
R: Variable class guard for three
R: if class guard for one
R: if class guard for three
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment