Why does it work fine for me? ^^" macbook:bin $ sudo cat /tmp/foo Hello world!!! macbook:bin $ sudo ./cf-agent -f /tmp/bar.cf -K macbook:bin $ sudo cat /tmp/foo Hello world!!! one two three
Cheers, --Nakarin On Dec 2, 2009, at 5:15 PM, Mark Burgess wrote: > > First you need to pass the list to the edit bundle with @(list) > rather than iterating too high up -- otherwise you will edit the file once > for each line, > instead of editing the file once with all lines. > > > see tests/units/unit_edit_insert_lines_silly.cf > > (attached) > > > > nwat...@symcor.com wrote: >> Greetings, >> >> I need some help with a editing promise that uses list iteration. >> >> body common control { >> bundlesequence => { "test" }; >> } >> >> bundle common g { >> classes: >> >> "all" expression => "any"; >> } >> >> bundle agent test { >> >> vars: >> >> any:: >> "x" slist => { "one", "two", "three" }; >> >> files: >> >> any:: >> "/tmp/foo" >> edit_line => AppendIfNoLine("${x}"); >> } >> >> bundle edit_line AppendIfNoLine(line) { >> insert_lines: >> "${line}" location => "append"; >> } >> >> body location append { >> before_after => "after"; >> } >> >> Expected results >> [r...@unxxhd01 inputs]# cat /tmp/foo >> one >> two >> three >> >> Actual results >> [r...@unxxhd01 inputs]# cf-agent -f ./bar.cf >> [r...@unxxhd01 inputs]# !cat >> cat /tmp/foo >> one >> >> What have I missed? >> >> >> Sincerely, >> -- >> Neil Watson >> 416-673-3465 >> >> >> ------------------------------------------------------------------------ >> >> >> >> CONFIDENTIALITY WARNING >> This communication, including any attachments, is for the exclusive use of >> addressee and may contain proprietary and/or confidential information. If >> you are not the intended recipient, any use, copying, disclosure, >> dissemination or distribution is strictly prohibited. If you are not the >> intended recipient, please notify the sender immediately by return e-mail, >> delete this communication and destroy all copies. >> >> AVERTISSEMENT RELATIF À LA CONFIDENTIALITÉ >> Ce message, ainsi que les pièces qui y sont jointes, est destiné à l’usage >> exclusif de la personne à laquelle il s’adresse et peut contenir de >> l’information personnelle ou confidentielle. Si le lecteur de ce message >> n’en est pas le destinataire, nous l’avisons par la présente que toute >> diffusion, distribution, reproduction ou utilisation de son contenu est >> strictement interdite. Veuillez avertir sur-le-champ l’expéditeur par retour >> de courrier électronique et supprimez ce message ainsi que toutes les pièces >> jointes. >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Help-cfengine mailing list >> Help-cfengine@cfengine.org >> https://cfengine.org/mailman/listinfo/help-cfengine > > -- > Mark Burgess > > ------------------------------------------------- > Professor of Network and System Administration > Oslo University College, Norway > > Personal Web: http://www.iu.hio.no/~mark > Office Telf : +47 22453272 > ------------------------------------------------- > > ####################################################### > # > # Insert a number of lines > # > ####################################################### > > body common control > > { > any:: > > bundlesequence => { "insert" }; > } > > > ####################################################### > > bundle agent insert > > { > vars: > > "v" slist => { > "One potato", > "Two potato", > "Three potatoe", > "Four" > }; > > files: > > "/tmp/test_insert" > > create => "true", > edit_line => Insert("@(insert.v)"); > # edit_defaults => empty; > > } > > ####################################################### > # For the library > ####################################################### > > bundle edit_line Insert(name) > > { > insert_lines: > > "$(name)"; > > } > > ####################################################### > > body edit_defaults empty > > { > empty_file_before_editing => "true"; > }_______________________________________________ > 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