Forum: CFEngine Help
Subject: log_* in action bodies created duplicate entries
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,27350,27350#msg-27350
Consider this:
body common control
{
bundlesequence => { "test" };
inputs => { "cfengine_stdlib.cf" };
}
bundle agent test
{
vars:
"software" slist => { "/tmp/123", "/tmp/xyz" };
files:
"$(software)"
create => "true",
perms => m("644"),
action => logme("$(software)");
}
body action logme(x)
{
log_kept => "/tmp/private_keptlog.log";
log_failed => "/tmp/private_faillog.log";
log_repaired => "/tmp/private_replog.log";
log_string => "$(sys.date) $(x) promise status";
}
Now we run it.
-> Created file /tmp/123, mode = 420
-> Created file /tmp/xyz, mode = 420
$ date
Thu Sep 13 14:24:56 EDT 2012
$ ls -l /tmp/123
-rw-r--r-- 1 newatson cad 0 Sep 13 14:24 /tmp/123
$ ls -l /tmp/xyz
-rw-r--r-- 1 newatson cad 0 Sep 13 14:24 /tmp/xyz
$ ls -l /tmp/private_*
-rw-rw-rw- 1 newatson cad 294 Sep 13 14:24 /tmp/private_keptlog.log
-rw-rw-rw- 1 newatson cad 98 Sep 13 14:24 /tmp/private_replog.log
$ cat /tmp/private_keptlog.log
Thu Sep 13 14:24:38 2012 /tmp/123 promise status
Thu Sep 13 14:24:38 2012 /tmp/123 promise status
Thu Sep 13 14:24:38 2012 /tmp/123 promise status
Thu Sep 13 14:24:38 2012 /tmp/xyz promise status
Thu Sep 13 14:24:38 2012 /tmp/xyz promise status
Thu Sep 13 14:24:38 2012 /tmp/xyz promise status
$ cat /tmp/private_replog.log
Thu Sep 13 14:24:38 2012 /tmp/123 promise status
Thu Sep 13 14:24:38 2012 /tmp/xyz promise status
How did eight log entries come from this? Ideally I should see just one for
each promiser. At worst I might expect to see two, one for create and one for
chmod for each promiser.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine