Skip to content

Instantly share code, notes, and snippets.

@tzz
Created November 6, 2014 15:49
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 tzz/d2a44f3afcfb30a74fdb to your computer and use it in GitHub Desktop.
Save tzz/d2a44f3afcfb30a74fdb to your computer and use it in GitHub Desktop.
body common control
{
inputs => { "$(sys.libdir)/stdlib.cf" };
bundlesequence => { "run", "write" };
}
bundle agent run
{
vars:
"var_slist" slist => {
"line1",
"line2 with space",
"line3",
"line4" };
"var_string" string => "teststring";
methods:
# make the Mustache template (usually you'd maintain it separately)
"" usebundle => file_make("$(this.promise_filename).mustache",
"slist = {{#vars.run.var_slist}}element = {{.}}, {{/vars.run.var_slist}}
string = {{vars.run.var_string}}");
}
bundle agent write
{
files:
"/tmp/output.txt"
create => "true",
edit_template => "$(this.promise_filename).mustache",
# note that without a template_data, we use the datastate() function!
# template_data => readjson($(json_file), "100k"),
template_method => "mustache";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment