Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
body common control {
bundlesequence => { "set_sections" };
}
bundle agent set_sections {
vars:
"value2in1" string => "No";
"value3in2" string => "Yes";
files:
"/tmp/foo"
edit_line => section_config("$(value2in1)", "$(value3in2)");
}
bundle edit_line section_config(value2in1, value3in2) {
delete_lines:
"value3.*"
select_region => INI_section("section=one");
"value2.*"
select_region => INI_section("section=one");
"value3.*"
select_region => INI_section("section=two");
insert_lines:
"value2=$(value2in1)"
select_region => INI_section("section=one");
"value3=$(value3in2)"
select_region => INI_section("section=two");
}
# This body comes from the cfengine_stdlib.cf
body select_region INI_section(x) {
select_start => "\[$(x)\]\s*";
select_end => "\[.*\]\s*";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.