Hello,
We're trying to pass an array as an argument to a bundle. However, it
doesn't work like expected.
The relevant code-snippets (in the files promises.cf and pip_lib.cf) are:
### promises.cf ###
body common control
{
bundlesequence => { pip_example };
inputs => {
"cfengine_stdlib.cf",
"pip_lib.cf",
};
}
bundle agent pip_example
{
vars:
any::
#
# Define the packages to install/delete
#
"pkgadd[yolk]" string => "0.4.3";
methods:
"any" usebundle => pip_install_pkg(@(pip_example.pkgadd)));
}
### pip_lib.cf ###
bundle agent pip_install_pkg(pkgs_array)
{
vars:
any::
"pip_install" slist => getindices("@(pkgs_array)");
When we run the code, the following 'error' is printed in the (verbose)
output:
{{{
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3> BUNDLE pip_install_pkg( {'@(pip_example.pkgadd)'} )
cf3> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3>
cf3> Initiate variable convergence...
cf3> ? Augment scope pip_install_pkg with pkgs_array (s)
cf3> !! List parameter "pip_example.pkgadd" not found while
constructing scope "pip_install_pkg" - use @(scope.variable) in calling
reference
}}}
We're using CFEngine Core 3.4.0a1.0530a8f.
If we use the same syntax to pass a list, it goes well.
Can anyone tell me if it's possible to pass arrays, and how it has to be
done?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine