Forum: CFEngine Help
Subject: abortclasses with global classes
Author: crd
Link to topic: https://cfengine.com/forum/read.php?3,23858,23858#msg-23858
Hi,
I'm trying to set up a structure where system configuration files are copied
from a master to a local tmp directory for use in later promises. I want the
bundle which performs this copy/update to halt cfengine execution completely if
it encounters any problems during the copy. This is to prevent problems down
the line with unexpanded variables etc.
To accomplish this I'm using abortclasses, the problem I'm having is that
globally defined classes don't seem to trigger the abort:
"$(g.local_source)/."
comment => "Update template files",
create => "true",
perms => mog("0600", "root", "root"),
depth_search => recurse("inf"),
copy_from =>
secure_cp_purge("$(g.remote_source)", "$(u_policyhost)"),
classes =>
if_else("file_source_update_complete", "abort_execution_g");
I believe the class "abort_execution_g" will be global when it is defined. If I
have in a body agent control section 'abortclasses =>
{"abort_execution_g"};' then execution is not halted.
If I hack around the problem by defining a local class from the global class
and change the abortclasses to 'abortclasses => {"abort_execution"};' it
works and cf-agent halts:
classes:
abort_execution_g:: #define local class to end execution (globals do
not trigger execution halt )
"abort_execution" expression => strcmp("test","test");
# true
Is this a bug or am I missing something? I can't see anything in the reference
about global classes not working. I'm using version 3.0.5 due to a need to use
the debian package repository.
Thanks
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine