Skip to content

Instantly share code, notes, and snippets.

@mikeweilgart
Created November 27, 2016 17:13
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 mikeweilgart/79f814e2b11c1f05c01fc0ba9ff0ea64 to your computer and use it in GitHub Desktop.
Save mikeweilgart/79f814e2b11c1f05c01fc0ba9ff0ea64 to your computer and use it in GitHub Desktop.
CFEngine 3 limits promise evaluation to three passes.
# Run me with:
# cf-agent -vKf ./dependencies.cf
bundle agent main {
vars:
any::
"pre_eval" string => "This is set during a pre-eval pass.";
first_pass_complete::
"second_pass" string => "Vars before classes, so this is set 2nd pass.";
second_pass_class::
"third_pass" string => "The class will be set by end of 2nd pass.
This var will be set during the 3rd pass.";
end_of_third_pass::
"oops" string => "Thanks to implementation quirks, this never gets set.";
classes:
any::
"first_pass_complete" expression => isvariable("pre_eval");
"second_pass_class" expression => isvariable("second_pass");
"end_of_third_pass" expression => isvariable("third_pass");
"i_am_not_set_but_logically_should_be" expression => isvariable("oops");
}
# Note: This behavior is *documented*;
# see https://docs.cfengine.com/lts/guide-language-concepts-normal-ordering.html
# The point is that documenting odd behavior doesn't make it optimal design.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment