Forum: Cfengine Help Subject: Re: simple edit_line Author: neilhwatson Link to topic: https://cfengine.com/forum/read.php?3,19617,19660#msg-19660
Replace_with should point to a body part not the string. http://www.cfengine.org/manuals/cf3-reference.html#replace_005fpatterns-in-edit_005fline-promises $ cf-promises -f ./bar.cf $ cf-agent -IKf ./bar.cf -> Edited file /tmp/test $ cat /tmp/test line3 line2 line3 line4 $ cat bar.cf ###################### body common control { bundlesequence => { "test" }; } bundle common g { classes: "all" expression => "any"; } bundle agent test { files: "/tmp/test" edit_line => myreplace("line1","line3"); } bundle edit_line myreplace(oldv,newv) { replace_patterns: "$(oldv)" replace_with => value("$(newv)"); } # From stdlib body replace_with value(x) { replace_value => "$(x)"; occurrences => "all"; } _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine