Forum: Cfengine Help
Subject: evaluation of variables
Author: joke
Link to topic: https://cfengine.com/forum/read.php?3,18954,18954#msg-18954

I did some stracing of cf-agent (3.1.0b2) and I'm wondering about the 
evaluation of variables.

I defined a common bundle containing a variable storing the output of 
execresult().

bundle common global {
    vars:
        "inputs" string => execresult("/usr/bin/find /etc/cfengine3/packages 
-name '*.cf' -printf %p\n", "noshell");
}


The strace files state that this exact find command is executed 16 times in my 
case.

strace.22157:execve("/usr/bin/find", ["/usr/bin/find", 
"/etc/cfengine3/packages", "-name", "*.cf", "-printf", "%p\\n"], [/* 40 vars 
*/]) = 0
strace.22158:execve("/usr/bin/find", ["/usr/bin/find", 
"/etc/cfengine3/packages", "-name", "*.cf", "-printf", "%p\\n"], [/* 40 vars 
*/]) = 0
................. 14 more lines .................


Why is the "inputs" variable evaluated that many times within just one run of 
cf-agent? Shouldn't the command not just be execute once?

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to