Forum: CFEngine Help
Subject: About "new" templates correct usage or limitations
Author: th
Link to topic: https://cfengine.com/forum/read.php?3,26723,26723#msg-26723
Hello,
I encouter the followig "issues" while using the new template mechanism
("edit_template" attribute) with cfengine-community-3.3.4 on CentOS release 6.3
x86_64 :
- if I use the "[%CFEngine BEGIN %]" and "[%CFEngine END %]" tags then, as
stated in the documentation ,each multi-line group maps to a multi-line
insert_lines promise, with insert_type => "preserve_block".
-> the content seems to be stored in a string, in which case, we soon come
to the
"Expansion overflow constructing string. Increase CF_EXPANDSIZE macro.
Tried to add [...]"
case.
(this occurs for instance with the main.cf postfix config file, which is
~480 lines long)
- if we don't use the "[%CFEngine BEGIN %]" and "[%CFEngine END %]" tags,
each line in the template maps to a separate "insert_lines"
-> we cannot preserve duplicate lines (such as empty lines, common in
config files for readability)
-> it can be slow and CPU intensive for large files, a case closely related
to the one described in
https://cfengine.com/forum/read.php?3,26695
My understanding is that (I might be wrong!), by philosophy, CFEngine is more a
line-oriented tool and that this new template feature was a facility to avoid
writing huge quoted promisers.
We first thought of editing config files by standard promises (edit_lines, ...)
but then we tought that if the file was somehow badly corrupted or erased,
"distributing" (think secure_cp) then expanding (edit_template) a template file
which would embed, CFEngine variables, class expressions ([%CFEngine
class-expression:: %] tags), tough less flexible, would guaranty anything could
happen to the file, it would be repaired, thus the dilemme giving the
limitations described above.
What do you think ? Am I just misinterpreting the way those templates are meant
to be used ?
Thanks
--
TH.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine