help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExpandVariables patch for the editfiles section


From: Mark Burgess
Subject: Re: ExpandVariables patch for the editfiles section
Date: Sun, 09 Oct 2005 17:55:19 +0200

Thanks for this patch. I have been meaning to do something likethis
for a while. It will be in 2.1.17

M

On Mon, 2005-07-18 at 23:06 +0200, Davor Ocelic wrote:
> Hello,
> 
> Allow me to inform you of the simple ExpandVariables patch
> (for the editfiles section) that performs expansion of variables in the
> input file to the values of correspondingly named cfengine variables.
> 
> http://colt.projectgamma.com/cfengine/cfengine-2.1.15-variable-expansion.patch
> 
> I have no deep cfengine knowledge, so any suggestions/corrections are welcome.
> 
> 
> My primary motive for coding it was the need to use templates with cfengine.
> As I envisioned it, in the update phase, templates would be transferred to the
> client along with other data. In the normal run, templates would then be 
> copied to 
> another location, variable-expanded and edited as appropriate, and finally 
> copied to their local destination.
> 
> 
> PATCH NOTES:
> - The function does not allow escaping of $() or ${} in input files to prevent
>   unintended expansion - all recognized variables are expanded. (You can, 
> however,
>   count on cfengine's behavior of passing non-existing variables through 
> verbatim).
> 
> - I wanted to make a function which would operate on a single line, but 
> didn't find
>   a convenient existing method to loop over all lines in a file manually. 
> Therefore,
>   the function scans and expands the whole file itself.
> 
> - Buffer size for expansion is of length CF_EXPANDSIZE. Is this sensible, 
> given that
>   both the static (invariant) and "dynamic" (expanded) part of the line must 
> fit in
>   that buffer for the function to succeed?
> 
> - It appears that a function in editfiles is not triggered unless it is 
> accompanyed
>   by an argument. So even though ExpandVariables does not use any arguments, 
> you need
>   to call  ExpandVariables ''  to trigger it. Does this fit the general logic?
> 
> 
> Best regards,
> -doc
> 
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine





reply via email to

[Prev in Thread] Current Thread [Next in Thread]