Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Created October 16, 2012 19: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 nickanderson/3901453 to your computer and use it in GitHub Desktop.
Save nickanderson/3901453 to your computer and use it in GitHub Desktop.
R: in bundle agent handler1: I got value1
R: in bundle agent handler1: I got value2
!! Method invoked repairs
!! Method invoked repairs
R: in bundle agent handler2: I got value1
R: in bundle agent handler2: I got value2
!! Method invoked repairs
!! Method invoked repairs
body common control {
bundlesequence => {"main",};
}
bundle agent main{
vars:
"mybundles" slist => { "handler1","handler2" };
"myvalues" slist => { "value1", "value2" };
methods:
"$(mybundle)" usebundle => handler_iterator("$(mybundles)", "@(main.myvalues)");
}
bundle agent handler_iterator(handler, values)
# This expects a single value
{
methods:
"$(handler)" usebundle => $(handler)("@(handler_iterator.values)");
}
bundle agent handler1(value1)
{
reports:
cfengine::
"in bundle agent handler1: I got $(value1)";
}
bundle agent handler2(value1)
{
reports:
cfengine::
"in bundle agent handler2: I got $(value1)";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment