Hi,

This is actually one of the first thing I tried to do with cf-engine, never
managed to do "correctly". Now I have much more cf-engine experience,
understands better how the software is supposed to work, but I am still
stuck on this one.

Basically this code explains what I want to do:

bundle agent setupConfiguration
{
        files:
        ClassA::
                "/var/my-config-file" edit_line => addLine("foo");
        ClassB::
                "/var/lib/my-config-file" edit_line => addLine("bar");
}

bundle edit_line addLine(line)
{
    insert_lines: "${line}";
}

I want to ensure that a file contains the lines foo and bar. The real story
is that it's of course way more complex, I have lots of classes and lines to
add, and the content to be added depends on some computations etc. But I got
everything working except this basic example.

The problem is that the second promise is never executed because cf-engine
thinks it is already kept by the first one. Eg, the promise is made on the
file, whereas obviously it also depends on the content of the addLine body.

How can I fix this? If it's a matter of rethinking things, as cf-engine
forces me to do almost everytime, it's OK, I just need a bit of help to
rethink the logic. But the basic idea is that I have a file that really
needs to be modified several times in a cf-engine run, with different
content added each time. I think convergence is not a problem here, as order
does not matter for me and I can also use the zeroing mode to empty the file
before editing if that would help.

Thanks

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

Reply via email to