Forum: CFEngine Help
Subject: Re: Supplementing an array within a bundle
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,23923,23924#msg-23924
Hm... I am pretty sure this was working at some point, because I have used it
in some sample policies. However I cannot get it to work now on Community
3.2.3. I will investigate.
As a workaround, you could declare the "inner" values in a different array, and
then merge the two into a final one, using something like this:
bundle agent caller
{
vars:
"v" string => "outer-value-1";
"v" string => "outer-value-2";
methods:
"any" usebundle => dest("caller.v");
}
bundle agent dest(v)
{
vars:
"v_comp" string => "default-1";
"v_comp" string => "default-2";
"index1" slist => getindices("$(v)");
"index2" slist => getindices("v_comp");
"index_final" slist => { @(index1), @(index2) };
"v_final[$(index1)]" string => "$($(v)[$(index1)])";
"v_final[$(index2)]" string => "$(v_comp[$(index2)])";
reports:
cfengine_3::
"index_final: $(index_final) value: $(v_final[$(index_final)])";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine