Skip to content

Instantly share code, notes, and snippets.

@rpetre
Created April 12, 2012 16:39
Show Gist options
  • Select an option

  • Save rpetre/2368955 to your computer and use it in GitHub Desktop.

Select an option

Save rpetre/2368955 to your computer and use it in GitHub Desktop.
cfengine 3 test to do version comparison
body common control {
bundlesequence => { "test" };
}
bundle agent version {
vars:
"versionlist" slist => splitstring($(sys.cf_version), "\.", 3);
"canonized" string => join( "", "versionlist");
}
bundle agent test {
classes:
"test_ok" expression => isgreaterthan( $(version.canonized), "301" );
reports:
test_ok::
"It worked for $(version.canonized)";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment