Hi,
I've got an issue with calling bundles with a loop - variables and
classes set on the first call to the bundle don't seem to get cleared on
the second and subsequent calls.
So for example:
body common control {
version => "1.0.0";
bundlesequence => {
"example"
};
inputs => {
"cfengine_stdlib.cf"
};
}
bundle agent example {
vars:
"names" slist => { "paul", "george", "ringo", "john" };
methods:
"any" usebundle => echoname("$(names)");
}
bundle agent echoname(name) {
commands:
!echo_run::
"/usr/bin/echo $(name)"
classes => if_repaired("echo_run");
}
The only promise it seems to keep is
"/usr/bin/echo paul"
I'm thinking that the issue is that whilst it looks like I can call a
bundle just like it was a subroutine with "usebundle", and the variables
and classes remain local in scope, that the variables and classes are
persistent between calls, so that once the first call sets "echo_run" to
true, it remains true for subsequent calls.
If this indeed the case, is there any way of clearing the namespace of a
bundle before it's entered with a "usebundle" call (or on exit), so that
it behaves a little more intuitively?
Thanks,
Simon
PS: Stuck on cfengine 3.0.4 / 3.0.5p1 for this exercise, due to a slew
of QA requirements.
--
Simon Oxwell
ControlCircle
Senior Server Engineer
The Datacentre People
Hertsmere House, 2 Hertsmere Road,
[email protected] <mailto:[email protected]>
London, E14 4AB
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine