It works fine for me. Here what I did. body common control { bundlesequence => { "test" }; inputs => { "/var/cfengine/inputs/cfengine_stdlib.cf" }; }
bundle agent test { files: "/tmp/sshd_config" edit_line => uncomment_lines_containing("PermitRootLogin.*","#"); } r...@testmachine:/tmp# grep Permit sshd_config #PermitRootLogin yes PermitEmptyPasswords no r...@testmachine:/tmp# cf-agent -f ./xxx.cf -IK Edited file /tmp/sshd_config r...@testmachine:/tmp# grep Permit sshd_config PermitRootLogin yes PermitEmptyPasswords no Cheers, --Nakarin On Nov 12, 2010, at 10:38 AM, Seifert, Christian wrote: > > Hello everybody, > I want to managing some configuration files of my system. > For example the file sshd_conf. I want to edit the line "PermitRootLoging > yes". In this line there has to be no comment - no # sign. > > I think i should use the bundle "edit_line > uncomment_lines_matching(regex,comment)", but it doesn't work for me. > My created file for this job is this: > > bundle sshd_conf { > > files: > "/tmp/sshd_conf" > > edit_line => AppendOrReplaceLineMatching("PermitRootLogin yes"); > > } > > bundle edit_line uncomment_lines_matching(regex,comment) > > # Uncomment lines of a file where the regex matches > # the text after the comment string > > { > replace_patterns: > > "$(comment)($(regex))$" replace_with => uncomment; > } > > > > It would be very nice if some of you has a promise like that. > > > Thanks in advance > > -- > Christian Seifert > > _______________________________________________ > 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