Forum: CFEngine Help
Subject: Re: if assignment in cfengine
Author: davidlee
Link to topic: https://cfengine.com/forum/read.php?3,24461,24463#msg-24463
Personally I use a structure something like:
files:
optional_class::
"my_file"
### copy/edit the file
classes => if_repaired("class_indicating_file_change");
commands:
### If a file was adjusted above, run a command:
optional_class::
"/sbin/service my_service restart"
ifvarclass => "class_indicating_file_change";
If the file operation results in a change of the file (usually it doesn't), it
sets the class "class_indicating_file_change".
Then in the commands section, the "ifvarclass" acts like an additional
selector: the service restart only happens when both "optional_class" AND
"class_indicating_file_change" are true (usually the latter is false; it is
only true at a file-change event).
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine