Forum: CFEngine Help
Subject: Re: abortclasses not working on commands
Author: bahamat
Link to topic: https://cfengine.com/forum/read.php?3,25504,25554#msg-25554
I use abortclasses, but not like you're using it.
Here's an example:
body agent control {
abortclasses => { "abort" };
}
bundle agent main {
classes:
"abort" expression => fileexists("/etc/passwd");
}
bundle agent test1 {
commands:
any::
"/bin/ls"
args => "/some/bogus",
classes => if_notkept("fatal_error");
reports:
fatal_error::
"there was an error that should have aborted";
}
bundle agent test2 {
commands:
any::
"/bin/ls"
args => "/tmp",
classes => if_ok("should_not_get_here");
reports:
should_not_get_here::
"you should not see this message";
}
body classes if_ok(x)
{
promise_repaired => { "$(x)" };
promise_kept => { "$(x)" };
}
body classes if_notkept(x)
{
repair_failed => { "$(x)" };
repair_denied => { "$(x)" };
repair_timeout => { "$(x)" };
}
body common control {
bundlesequence => {
"main",
"test1",
"test2",
};
}
And the output:
$ sudo cf-agent -f ./abort.cf
cf-agent aborted on defined class "abort" defined in bundle main
I think that by the time you're defining the abort class it's too late to abort.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine