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

Reply via email to