The promises look good, and AFAICT you should always get 2 lines, but I'd
suggest the following change for you:
vars:
any::
"dns" string => "192.168.1.20";
machineX::
"search" string => "domain2";
!machineX::
"search" string => "domain1";
This makes it clearer what variables are set under what conditions, and there
is no need for the policy "free" any more, because there is no reassignment.
-Dan
On Feb 23, 2011, at 8:11 AM, Adalbert Michelic wrote:
> I have a problem with some constellations of edit_line bundles
> together with edit_defaults=>empty. I have included the simpler
> bundle of the two creating problems below -- my expectation would be
> to get an /etc/resolv.conf with two lines -- all machines expect
> machineX should have domain1 as search list, only machineX should
> have domain2.
>
> Most of the time it works without problems - especially, if I run
> cf-agent manually. But cf-agent is also run every 15 minutes by
> cf-execd, and then sometimes the file is generated without the
> nameserver line. I haven't found a pattern for this misbehaviour,
> but I suspect it might be connected with a high load on the machine,
> which makes cf-agent run for more than 15 minutes.
>
> I have the same problem as well with another file which is generated
> in the same manner (taking into account several variables, so I
> don't want to just copy a template) - sometimes some of the lines
> that should be there are missing. If I trigger cf-agent manually,
> all lines re-appear as they should.
>
> Am I doing something with those edits?
>
>
> Thanks,
> Adalbert
>
>
>
> bundle agent main {
> files:
> "$(sys.resolv)"
> create => "false",
> edit_line => resolver,
> edit_defaults => empty;
> }
>
> bundle edit_line resolver {
> vars:
> "search" string => "domain1", policy => "free";
> "dns" string => "192.168.1.20", policy => "free";
>
>
> machineX::
> "search" string => "domain2", policy=>"free";
>
> insert_lines:
> "search $(search)";
> "nameserver $(dns)";
> }
>
> body edit_defaults empty
> {
> empty_file_before_editing => "true";
> edit_backup => "false";
> max_file_size => "300000";
> }
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine