A+B: Difference between revisions

Content added Content deleted
(CFEngine example)
m (CFEngine example tidy)
Line 1,853: Line 1,853:


<syntaxhighlight lang="cfengine">
<syntaxhighlight lang="cfengine">
$ cat sum.cf
bundle agent main
bundle agent main
{
{
Line 1,872: Line 1,873:
"input[${indices}] is ${with}" with => storejson( "input[${indices}]" );
"input[${indices}] is ${with}" with => storejson( "input[${indices}]" );
}
}
</syntaxhighlight>


$ cat input.txt
with input.txt next to sum.cf (above policy file), run cf-agent -KIf ./sum.cf and output will be
2 3
2 2


$ cf-agent -KIf ./sum.cf
R: 5
R: 5
R: 4
R: 4
</syntaxhighlight>


The "R:" prefix is for a report promise and the only way to output to stdout with policy.
The "R:" prefix is for a report promise and the only way to output to stdout with policy.