Skip to content

Instantly share code, notes, and snippets.

@martingehrke
Created March 27, 2015 19:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martingehrke/2a716ca649983a0f7cb2 to your computer and use it in GitHub Desktop.
Save martingehrke/2a716ca649983a0f7cb2 to your computer and use it in GitHub Desktop.
An example of how to do complex conditionals in CFEngine
#pseudocode
if x == 7 and (y<10 or y>20):
do something
#using classes
or_class_set or => {"less_than_ten", "greater_than_twenty"};
and_class_set and => {"or_class_set", "equals_seven"};
#is the same as
and_class_set and => {"equals_seven", "less_than_ten|greater_than_twenty"};
#using expressions
or_class_set expression => "less_than_ten|greater_than_twenty";
and_class_set and => "or_class_set.equals_seven";
#is the same as
and_class_set expression => "equals_seven.(less_than_ten|greater_than_twenty)";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment