Forum: Cfengine Help Subject: expand_template non-convergant? Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,21562,21562#msg-21562
So, I have a bundle which expands a template, and it seems to be editing the file everytime it runs. I find this bothersome. This doesn't happen on other templates, but those have variables which don't expand to things containing newlines, which is what I perhaps naiively suspect the problem to be here.. Anyone see what obvious thing I'm overlooking? For the record, I eventually got this working without the template by just getting rid of the join and using edit_line => insert_lines("@(set_securetty.tty_list)"), But I still want to know why the template version below, bad as it is, was recreating the same file every time. Here's the original bundle (with a shortened list of ttys): bundle agent set_securetty { vars: "securettypath" string => "/etc/securetty"; "template" string => "/path/to/securetty.template"; # ports which should be in the file on all platforms any:: "tty_common"slist => { "console" }; # per-OS ports linux:: "tty_os" slist => { "ttyS0", "ttyS1" }; !linux:: "tty_os" slist => { "" }; any:: "tty_list" policy => "ifdefined", slist => { @(tty_common), @(tty_os) }; "ttys" string => join("$(const.n)", "tty_list"); reports: edited_securetty:: "Changed $(securettypath)"; files: "$(securettypath)" perms => mog("644", "root", "root"), create => "true", edit_defaults => empty, edit_line => expand_template("$(template)"), classes => if_repaired("edited_securetty"), comment => "Set perms and content of $(securettypath)", handle => "manage_securetty"; } The template was just this: # cat /path/to/securetty.template $(set_securetty.ttys) Thanks. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine