Oh yeah, I forgot to look there.  Although now that I do, that looks really 
familiar.  I think I might have tried to use it very early on but got confused 
by that array so just went off and wrote my own.  Unfortunately, that bundle 
uses field_edits, which I've recently found to (currently) be incapable of 
handling some of my values properly.  I've filed an RFE that describes my 
problem.

https://cfengine.com/bugtracker/view.php?id=174

Cfengine is missing one very critical component for complete CSV (or in this 
case, Equal Sign Separated Values) handling via field_edits: a text delimiter 
for values.  An inserted text value cannot contain a character that matches the 
field delimiter (or presumably the value delimiter).
--
/* Wes Hardin */
Maxim Integrated Products: Innovation Delivered

On 07/01/2010 10:20 PM, Daniel V Klein wrote:
> Heh - just use "set_variable_values" from cfengine_stdlib.cf!  Or see how it
> is done there - it's rather clever (I wish I thought of it :-)
>
> -Dan
>
>> Forum: Cfengine Help
>> Subject: Looking for suggestions on ordering
>> Author: Authority
>> Link to topic: https://cfengine.com/forum/read.php?3,17628,17628#msg-17628
>>
>> Normal ordering for edit_line bundles puts insert_lines before replace_patter
>> ns.  For my current problem, I'm trying to reverse them.
>>
>> Given a simple syntax like this:
>>
>> option = value
>>
>> I would like to check that the option exists and simply replace the current v
>> alue with the new value and if the option doesn't exist, add the line.  This
>> is problematic though because the syntax of my files are flexible regarding w
>> hite space but insert_lines is not.  If my insert_lines promiser does not hav
>> e any whitespace around the equals sign but the file does, or if the option i
>> s indented, even though the option and value are as they should be, Cfengine
>> will insert a new line.  Replace_patterns is powerful enough to handle and pr
>> eserve whitespace but I'm having trouble stopping the insert_line from happen
>> ing after replace_patterns has already done its work.  I only want the insert
>> _line to happen if the replace_pattern couldn't find and replace the value.
>>
>> I've found that a replace_patterns promise that doesn't match anything (and t
>> hus doesn't replace anything) is still marked as kept, which I can kind of un
>> derstand (nothing to do is just as good as already being done), but it makes
>> it very hard to determine if replace_patterns took any action.
>>
>> I've tried setting a class at the start of the bundle that blocked the insert
>> _lines promises and was cancelled by replace_patterns, but that class was rea
>> ctivated when the bundle was re-evaluated so my inserts never happened.
>>
>> I'm not going to argue that the normal ordering be changed as I think for mos
>> t cases, it is optimal already, but I'm wondering if a new promise result cla
>> ss attribute (for use in class bodies) might be worthwhile, something along t
>> he lines of match_found, that would activate classes if the regex in the curr
>> ent promise succeeded.
>>
>> Has anyone else dealt with such ordering issues?  Any suggestions/tricks on h
>> ow to do this?
>>
>> _______________________________________________
>> Help-cfengine mailing list
>> Help-cfengine@cfengine.org
>> https://cfengine.org/mailman/listinfo/help-cfengine
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to