Matt,

I've given this some thought and I think there is nothing
particularly wrong with cfengine's behaviour. However, the
example is contrived and I would advise against this kind
of thing. I would need to see evidence of something wrong
in a different example that I could recommend to someone.

M


Matt Richards wrote:
> I am not even sure how to describe this one. I have included a test
> case below. What is happening is that every other time it is run,
> "foo" is added. So, half the time it is added, the other half it is
> not. It seems like it somehow knows that foo was in /tmp/test at one
> point, even though it was removed.
> 
> Output (from the report output):
> 
> 1st run (correct, foo was added):
> cf3 R: array 0
> cf3 R: indices $(indices)
> 
> 2nd run (somehow foo is in there, but foo ends up not being added):
> cf3 R: array 1
> cf3 R: indices foo
> 
> 3rd run (now it is gone again, and foo is added):
> cf3 R: array 0
> cf3 R: indices $(indices)
> 
> wash, rinse, repeat....
> 
> ###
> 
> body common control {
> 
>     bundlesequence      => { "test","run" };
> }
> 
> ###
> 
> bundle agent test {
>  files:
> 
>    "/tmp/test"
>       create => "true",
>       edit_line => remove_all;
> 
> }
> 
> ###
> bundle edit_line remove_all {
> 
>    delete_lines:
>        ".*";
> }
> 
> ###
> bundle agent run {
> 
> vars:
>     "array" int => readstringarray("test","/tmp/test","#[^\n]*",":",50,40000);
>     "indices" slist => getindices("test");
> 
> classes:
>     "not_found"   expression => islessthan("$(array)",1);
> 
> files:
>      not_found::
>       "/tmp/test"
>        edit_line => add_line("foo");
> 
> reports:
> Yr2009::
>   "array $(array)";
>   "indices $(indices)";
> 
> }
> 
> ###
> 
> bundle edit_line add_line(x) {
> 
>   insert_lines:
>     "$(x)";
> }
> _______________________________________________
> Bug-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/bug-cfengine

-- 
Mark Burgess

-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway

Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to