Created
September 7, 2012 16:07
-
-
Save nickanderson/3667439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body common control { | |
inputs => { "../sketches/CFEngine/stdlib/cfengine_stdlib.cf" }; | |
bundlesequence => { "main" }; | |
} | |
bundle agent main | |
{ | |
vars: | |
"cat_hat" string => "true"; | |
"cat_tail" string => "true"; | |
methods: | |
"story time" usebundle => test("main.cat_"); | |
} | |
bundle agent test(prefix) | |
{ | |
vars: | |
"bundle" string => "test"; | |
"class_prefix" string => "$(prefix)$(bundle)_"; | |
classes: | |
"$(class_prefix)thing1" expression => regcmp("true", "$($(prefix)hat)"); | |
"$(class_prefix)thing2" expression => regcmp("true", "$($(prefix)tail)"); | |
# Define redfish when thing one but not thing 2 | |
# Notice that class_prefix contains illegal characters (the dot in main.cat_) | |
# So when testing the existance of the classes must be careful to | |
# classify/canonify the strings | |
"$(class_prefix)redfish" and => { classify("$(class_prefix)thing1"), | |
classify(not("$(class_prefix)thing2")) | |
}; | |
reports: | |
cfengine:: | |
"I have a cat in a hat with no tail", | |
ifvarclass => canonify("$(class_prefix)redfish"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment