Skip to content

Instantly share code, notes, and snippets.

@jooooooon
Created March 19, 2011 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jooooooon/877383 to your computer and use it in GitHub Desktop.
Save jooooooon/877383 to your computer and use it in GitHub Desktop.
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