1. You pass a list to the method
2. the $(d) becomes an iterator for both vars and commands
3. the last value wins in the vars assisgnment because it happens last, and is
thereafter
constant
4. the iteration over echo has constant x and 3 x variable d,
Nicolas Charles wrote:
> This is strange in
This is strange indeed, I played with your example to understand what was
happening, and I tried this
body common control {
bundlesequence => { "foo" };
}
bundle agent foo {
vars:
"d" slist => { "1.one","1.two","1.three" };
methods:
"any" usebun
help-cfengine-boun...@cfengine.org wrote on 2009-12-02 16:13:56:
> Hi,
>
> Why don't you use only ${d} in methods?
>
> methods:
> "any" usebundle => subfoo("${d}");
>
> I think you would get expected results.
It does but as Mark pointed out it is a little more efficient to pass the
list one
Hi,
Why don't you use only ${d} in methods?
methods:
"any" usebundle => subfoo("${d}");
I think you would get expected results.
Cheers,
--Nakarin
On Dec 2, 2009, at 9:28 PM, nwat...@symcor.com wrote:
> Thanks for the tip Mark. Using this method again for something different
> get's me som
Thanks for the tip Mark. Using this method again for something different
get's me some unexpected results:
body common control {
bundlesequence => { "foo" };
}
bundle common g {
vars:
sunos_5_10::
"svc_cmd" string => "/usr/sbin/svcadm",
It should work, it is just inefficient :-)
Nakarin Phooripoom wrote:
> Why does it work fine for me? ^^"
>
> macbook:bin $ sudo cat /tmp/foo
> Hello world!!!
> macbook:bin $ sudo ./cf-agent -f /tmp/bar.cf -K
> macbook:bin $ sudo cat /tmp/foo
> Hello world!!!
> one
> two
> three
>
> Cheers,
> --
Why does it work fine for me? ^^"
macbook:bin $ sudo cat /tmp/foo
Hello world!!!
macbook:bin $ sudo ./cf-agent -f /tmp/bar.cf -K
macbook:bin $ sudo cat /tmp/foo
Hello world!!!
one
two
three
Cheers,
--Nakarin
On Dec 2, 2009, at 5:15 PM, Mark Burgess wrote:
>
> First you need to pass the list to
First you need to pass the list to the edit bundle with @(list)
rather than iterating too high up -- otherwise you will edit the file once for
each line,
instead of editing the file once with all lines.
see tests/units/unit_edit_insert_lines_silly.cf
(attached)
nwat...@symcor.com wrote:
> G
Greetings,
I need some help with a editing promise that uses list iteration.
body common control {
bundlesequence => { "test" };
}
bundle common g {
classes:
"all" expression => "any";
}
bundle agent test {
vars:
any::
"x" slist => { "one", "two", "thr