Skip to content

Instantly share code, notes, and snippets.

@zzamboni
Created March 12, 2012 18:50
Show Gist options
  • Select an option

  • Save zzamboni/2023934 to your computer and use it in GitHub Desktop.

Select an option

Save zzamboni/2023934 to your computer and use it in GitHub Desktop.
body common control
{
bundlesequence => { "globals" };
}
bundle agent foo(name)
{
vars:
"var_$(name)" string => "Hi $(name)";
reports:
cfengine::
"$(name) = $(var_$(name))";
}
bundle agent globals
{
methods:
"boo" usebundle => foo("boo");
"bar" usebundle => foo("bar");
reports:
cfengine::
# Only foo.var_bar works. Why?
# If I reverse the methods: promises, then only var_boo works.
# It seems only the most-recently-set variable is properly expanded.
# UPDATE: of course. The namespace for each bundle is cleared each time it's called.
# It's not an array, it's a bundle :)
"$(foo.var_boo)";
"$(foo.var_bar)";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment