On 02/13/2012 01:09 PM, [email protected] wrote:
> Forum: CFEngine Help
> Subject: Re: Problems looping over slist with global reference
> Author: mark
> Link to topic: https://cfengine.com/forum/read.php?3,24805,24812#msg-24812
>
> I'm afraid this is the documented behaviour. Consider it a known bug for the
> time being.
So I suppose this is related to how I can't seem to get a slist out of
an array when the array is passed to a bundle.
I tried several things, but none were successful.
R: test: l1 $(config[key])
R: test: l2 $(main.array[key])
R: test: l3 $(main.array[key])
R: test: l4 $(main.array[key])
R: test: l5 $($(main.array)[key])
R: test: l6 @(main.array[key])
R: test: l7 @(config[key])
R: test: s1 stringvalue
R: test: s2 stringvalue
R: main: l1 listitem1
R: main: l1 listitem2
R: main: l2 $(this.array[key])
--
Nick Anderson <[email protected]>
body common control {
bundlesequence => {
"main",
};
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent main {
vars:
"array[key]" slist => { "listitem1", "listitem2" };
"array[key2]" string => "stringvalue" ;
methods:
"any" usebundle => test("main.array");
reports:
cfengine::
"main: l1 $(array[key])";
"main: l2 $(this.array[key])";
}
bundle agent test(config){
vars:
"mylist" slist => { "@(config[key])" };
reports:
cfengine::
# None of the list expansion/iteration from a passed array seem to
work
"test: l1 $(config[key])";
"test: l2 $($(config)[key])";
"test: l3 $($(this.config)[key])";
"test: l4 $(main.array[key])";
"test: l5 $($(main.array)[key])";
"test: l6 @(main.array[key])";
"test: l7 $(mylist)";
# String expansion seems to work fine
"test: s1 $($(config)[key2])";
"test: s2 $(main.array[key2])";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine