Skip to content

Instantly share code, notes, and snippets.

@neilhwatson
Created September 19, 2014 12:49
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 neilhwatson/5353cae3fc2c76ae9af8 to your computer and use it in GitHub Desktop.
Save neilhwatson/5353cae3fc2c76ae9af8 to your computer and use it in GitHub Desktop.
CFEngine comparing two numbers using strcmp
neil@ettin ~/.cfagent/inputs $ cat equalto.cf
body common control
{
bundlesequence => {
"main",
};
}
bundle agent main
{
methods:
"any" usebundle => test;
}
bundle agent test
{
vars:
"one" int => "1";
"uno" int => "1";
classes:
"PASS"
expression => strcmp( "${one}", "${uno}" );
reports:
PASS::
"PASS ${one} == ${uno}";
!PASS::
"FAIL ${one} != ${uno}";
}
neil@ettin ~/.cfagent/inputs $ cf-agent -Kf ./equalto.cf
R: PASS 1 == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment