Forum: CFEngine Help
Subject: Re: Trying to use regex to edit multiple files but CFengine 3.2.1 only
edits one file. Why?
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,25435,25454#msg-25454
Not only is the use of touch => true non-convergant, but I can't get
effectively the same thing to work with or without touch (on community 3.2.1),
and with the regex in either the middle or the end of the file. Maybe cf-agent
doesn't like me as much as it likes Mark. :)
I'm thinking this is a bug (perhaps a new one, since it seemingly worked
before)...
root@host:/tmp # touch test/{a,b,c,d}.cf
root@host:/tmp # cat test/{a,b,c,d}.cf
root@host:/tmp # ls test/{a,b,c,d}.cf
test/a.cf test/b.cf test/c.cf test/d.cf
root@host:/tmp # cf-agent -b a -IKf ./test.cf
>> Using command line specified bundlesequence
-> Edited file /tmp/test/c.cf
root@host:/tmp # cat test.cf
#!/var/cfengine/bin/cf-agent -b a -K -f
bundle agent a {
files:
"/tmp/test/.*" edit_line => myedit;
}
bundle edit_line myedit {
insert_lines:
"kaboom!";
}
root@host:/tmp # cf-agent -b astudent03.classroom -IKf ./test.cf
>> Using command line specified bundlesequence
root@host:/tmp # vim test.cf
root@host:/tmp # cat test.cf
#!/var/cfengine/bin/cf-agent -b a -K -f
bundle agent a {
files:
"/tmp/test/.*" edit_line => myedit, touch => "true";
}
bundle edit_line myedit {
insert_lines:
"kaboom!";
}
root@host:/tmp # cf-agent -b a -IKf ./test.cf
>> Using command line specified bundlesequence
-> Touched (updated time stamps) /tmp/test/c.cf
-> Touched (updated time stamps) /tmp/test/c.cf
-> Touched (updated time stamps) /tmp/test/b.cf
-> Touched (updated time stamps) /tmp/test/b.cf
-> Touched (updated time stamps) /tmp/test/a.cf
-> Touched (updated time stamps) /tmp/test/a.cf
-> Touched (updated time stamps) /tmp/test/c.cf.cf-before-edit
-> Touched (updated time stamps) /tmp/test/c.cf.cf-before-edit
-> Touched (updated time stamps) /tmp/test/d.cf
-> Touched (updated time stamps) /tmp/test/d.cf
root@host:/tmp # cat test/{a,b,c,d}.cf
kaboom!
root@host:/tmp # wc -l /tmp/test/{a,b,c,d}.cf
0 /tmp/test/a.cf
0 /tmp/test/b.cf
1 /tmp/test/c.cf
0 /tmp/test/d.cf
1 total
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine