Skip to content

Instantly share code, notes, and snippets.

@filler
Created June 7, 2012 13:39
Show Gist options
  • Save filler/2888842 to your computer and use it in GitHub Desktop.
Save filler/2888842 to your computer and use it in GitHub Desktop.
yale v cfengine stdlib collisions?
[root@localhost inputs]# cf-agent -K
cf3> /var/cfengine/inputs/yale_stdlib.cf:38,54: Redefinition of body "check_range" for "process_count" is a broken promise, near token '{'
cf3> /var/cfengine/inputs/yale_stdlib.cf:726,29: Redefinition of body "if_repaired" for "classes" is a broken promise, near token '{'
R: --> I'm a policy hub.
[root@localhost inputs]# grep -C5 if_repaired *stdlib.cf
cfengine_stdlib.cf-
cfengine_stdlib.cf- comment => "A user's regular batch jobs are added to this file",
cfengine_stdlib.cf- create => "true",
cfengine_stdlib.cf- edit_line => append_if_no_line("$(mins) $(hours) * * * $(commands)"),
cfengine_stdlib.cf- perms => mo("644","$(user)"),
cfengine_stdlib.cf: classes => if_repaired("changed_crontab");
cfengine_stdlib.cf-
cfengine_stdlib.cf-processes:
cfengine_stdlib.cf-
cfengine_stdlib.cf-changed_crontab::
cfengine_stdlib.cf- "cron"
--
cfengine_stdlib.cf-##
cfengine_stdlib.cf-## classes
cfengine_stdlib.cf-##
cfengine_stdlib.cf-
cfengine_stdlib.cf-
cfengine_stdlib.cf:body classes if_repaired(x)
cfengine_stdlib.cf-{
cfengine_stdlib.cf-promise_repaired => { "$(x)" };
cfengine_stdlib.cf-}
cfengine_stdlib.cf-
cfengine_stdlib.cf-##
--
yale_stdlib.cf-# classes bodies
yale_stdlib.cf-#
yale_stdlib.cf-################################################################################
yale_stdlib.cf-
yale_stdlib.cf-# If this promise was repaired, turn on class x
yale_stdlib.cf:body classes if_repaired(x) {
yale_stdlib.cf-
yale_stdlib.cf- promise_repaired => { "$(x)" };
yale_stdlib.cf-
yale_stdlib.cf-}
yale_stdlib.cf-
[root@localhost inputs]# grep -C5 check_range *stdlib.cf
cfengine_stdlib.cf-out_of_range_define => { "$(cl)" };
cfengine_stdlib.cf-}
cfengine_stdlib.cf-
cfengine_stdlib.cf-##
cfengine_stdlib.cf-
cfengine_stdlib.cf:body process_count check_range(name,lower,upper)
cfengine_stdlib.cf-{
cfengine_stdlib.cf-match_range => irange("$(lower)","$(upper)");
cfengine_stdlib.cf-out_of_range_define => { "$(name)_out_of_range" };
cfengine_stdlib.cf-}
cfengine_stdlib.cf-
--
yale_stdlib.cf-# Count the number of processes in the process table matching regex "name". If
yale_stdlib.cf-# the number lies between the values "lower" and "upper", enable class
yale_stdlib.cf-# "<name>_in_range"; otherwise "<name>_out_of_range".
yale_stdlib.cf-#
yale_stdlib.cf-# Useful for restarting dead and spawning-out-of-control processes.
yale_stdlib.cf:body process_count check_range( name, lower, upper ) {
yale_stdlib.cf-
yale_stdlib.cf- match_range => irange("$(lower)","$(upper)");
yale_stdlib.cf- in_range_define => { "$(name)_in_range" };
yale_stdlib.cf- out_of_range_define => { "$(name)_out_of_range" };
yale_stdlib.cf-
[root@localhost inputs]# grep -C5 stdlib promises.cf
body common control
{
bundlesequence => { "main" };
inputs => {
"cfengine_stdlib.cf",
"yale_stdlib.cf",
};
version => "Community Promises.cf 1.0.0";
}
[root@localhost inputs]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment