I'm trying to generate a dynamic bundlesequence using the global classes of a common bundle but something isn't right with the output. This is a simplified version of the real policy requiring 3 three passes of common.
bundle common classify
{
classes:
"c" expression => "b";
"b" expression => "a";
"a" expression => "any";
}
body common control
{
bundlesequence =>
{
"classify",
"get_bundles",
@(get_bundles.bundle_ind),
};
}
bundle agent get_bundles
{
vars:
a::
"bundle[report_a]" string => "file_a";
b::
"bundle[report_b]" string => "file_b";
c::
"bundle[report_c]" string => "file_c";
d::
"bundle[report_d]" string => "file_d";
any::
"bundle_ind" slist => getindices("bundle");
reports:
any::
"bundles: $(bundle_ind)";
}
bundle agent report_a
{
reports:
"a";
c::
"a: c is set";
}
bundle agent report_b
{
reports:
"b";
c::
"b: c is set";
}
bundle agent report_c
{
reports:
"c";
}
getindices returns report_a, report_b, report_c but the last bundle is not called.
If the class guards of get_bundles are changed to a.null:: and b.null:: (so not set) then getindicies returns report_c but I get a fatal error because the bundlesequence contains 'cf_null'
Is this an error on my part or that of cfengine?
Mark