Look at the readstringlist and readstringarray builtin functions. Also, see http://www.cfengine.org/manuals/cf3-reference.html#Introduction-to-functions which is a handy guide to which functions return what (once you've perused the whole list to get familiar with them, of course :-)
-Dan > I have a cfengine2 config I'm converting to cfengine3, but can't find how to > read in a file as I've done previously. Here's my cf2 config that reads in a > shadow-formatted file, and updates the local /etc/shadow based on it: > editfiles: > (solaris|solarisx86|linux):: > { /etc/shadow > SplitOn ":" > ForEachLineIn "$(mylocaldir)/myshadow-file" > ReplaceLinesMatchingField "1" > EndLoop > } > > > So far, I've just got basic shadow editing working in cf3 for the root user, > I'm now looking to expand on this: > bundle agent update_shadow { > vars: > (solaris|solarisx86|linux):: > "shadow_hash" string => "86CO2ExDV.gK2"; > files: > "/etc/shadow" > comment => "Modify root password", > edit_line => set_user_field("root",2,"$(shadow_hash)"); > > } > > > Thanks, > > RCA > -- > UNIX Administrator, BAE Systems EIT > desk 763-572-6684 mobile 612-419-9362 > _______________________________________________ > 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