Hi, May I show you a modified set_variable_values bundle? This came out of one of my classes.
The main difference is you won't get lines like "name =value2" if you start with "name = value1". (Note the asymetrical space around the equals sign.) Instead you get lines like "name=value2". It was a useful class exercise, that's for sure. I'm not sure if it'd be useful to the broader community, or worth suggesting an update to the COPBL. BTW, props to Diego for set_variable_values, it is very useful! We are just building on his work a little bit. Like I said, I'm not sure if this might of interest/use to you? bundle edit_line set_variable_values__symmetrical(v) # The main difference from set_variable_values is that # you won't get lines like "name =value2" if you start with # "name = value1". (Note the asymetrical space around # the equals sign.) Instead you get lines like "name=value2". { vars: "index" slist => getindices("$(v)"); field_edits: # match a line starting like the key *BLANK SPACE* = something "\s*$(index)\s+=.*" edit_field => col("=","1","$(index)","set"), hitespace otherwise our insert_lines promise would create a duplicate name=value entry WITHOUT whitespace."; # match a line starting like the key = something "\s*$(index)=.*" edit_field => col("=","2","$($(v)[$(index)])","set"), espace after the equals sign."; insert_lines: "$(index)=$($(v)[$(index)])", comment => "Insert name=value definition"; } }}} _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine