Forum: Cfengine Help Subject: Cfengine 3.1.4 and replace_patterns Author: berntjernberg Link to topic: https://cfengine.com/forum/read.php?3,20414,20414#msg-20414
Hi, I'm trying to replace the line D{MTAHost}[127.0.0.1] with D{MTAHost}[$(g.mailrelay)] using this code bundle edit_line replace_line(old_value,new_value) { replace_patterns: "$(old_value)" replace_with => value("$(new_value)"), classes => if_repaired("pattern_replaced"); } bundle agent manage_sendmail { files: "/etc/mail/submit.cf" perms => mog(0644,root,sys), edit_line => replace_line("^D\{MTAHost\}\[(?!$(g.mailrelay))\].*$","D\{MTAHost\}\[$(g.mailrelay)\]"), classes => if_repaired("d_submit_cf_updated"); } but I just can't get it to work. I tested with/without backslashes with/without .* but to no luck. I'm using pcre 8.12. Any ideas? _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine