Forum: CFEngine Help
Subject: replace_with unexpected results
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,24935,24935#msg-24935
I have an edit line bundle that inserts lines into an emptied file and replaces
a given string during the insert. It seems that the agent only performs one
replace and the locks the promise
cf3> -> Looking at pattern \[[1-9]+:[1-9]+\]
cf3> -> Verifying replacement of "\[[1-9]+:[1-9]+\]" with "[0:0]" (2)
cf3> -> Replaced pattern "\[[1-9]+:[1-9]+\]" in /tmp/.iptable_save
# this is good. But later:
cf3> -> Looking at pattern \[[1-9]+:[1-9]+\]
cf3> -> This promise has already been verified
My expected result was that all possible replaces would occur. Here are the
promises:
"/tmp/.iptable_save"
handle => "shorewall_iptables_save",
create => "true",
perms => mog("600", "root", "root"),
edit_defaults => empty,
classes => cfop_status(
"cfop_shorewall_iptables_save_kept",
"cfop_shorewall_iptables_save_repaired",
"cfop_shorewall_iptables_save_failed"
),
edit_line => iptables_clear_counters(
@{shorewall.iptables_save} );
bundle edit_line iptables_clear_counters(l) {
insert_lines:
"${l}";
replace_patterns:
"\[[1-9]+:[1-9]+\]" replace_with => value("[0:0]");
}
body replace_with value(x)
{
replace_value => "$(x)";
occurrences => "all";
}
I'm using community 3.2.0.
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine