Forum: CFEngine Help Subject: var-context not relevant in commands, but relevant in reports? Author: ErikOonk Link to topic: https://cfengine.com/forum/read.php?3,24003,24003#msg-24003
Hello all, I'm probably missing something really obvious, but I can't figure out this one... I want to check if a particular service is enabled on a CentOS 5.5 box, and to use chkconfig to enable it if it isn't... Can anyone enlighten me what happens to the varclass ${s)_enabled here to cause this behaviour? Here is the relevant part of my cfengine config: bundle agent chkconfig_status(s){ # Report whether service is enabled using chkconfig classes: "${s}_enabled" expression => returnszero("/sbin/chkconfig ${s}","noshell"); commands: "/sbin/chkconfig --add ${s}" , ifvarclass => "${s}_enabled"; reports: redhat:: "Service ${s} is enabled", ifvarclass => "${s}_enabled"; "Service ${s} is not enabled", ifvarclass => "!${s}_enabled"; } If I run cf-agent, I get the following output: The reports part: cf3> Promise handle: cf3> Promise made by: Service postfix is not enabled cf3> ......................................................... cf3> cf3> Report: Service postfix is not enabled cf3> R: Service postfix is not enabled The commands part: cf3> Skipping whole next promise (/sbin/chkconfig --add postfix), as var-context postfix_enabled is not relevant _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine