The following promise

"myarray[$(mykeys)]" string => execresult("/usr/bin/ps -f | grep
$(mylist[$(mykeys)])","useshell");

will expand not the way you expecting it. It doesn't mean

"myarray[a]" string => execresult("/usr/bin/ps -f | grep
$(mylist[a])","useshell");
"myarray[b]" string => execresult("/usr/bin/ps -f | grep
$(mylist[b])","useshell");
"myarray[c]" string => execresult("/usr/bin/ps -f | grep
$(mylist[c])","useshell");

Instead, it means

"myarray[a]" string => execresult("/usr/bin/ps -f | grep
$(mylist[a])","useshell");
"myarray[a]" string => execresult("/usr/bin/ps -f | grep
$(mylist[b])","useshell");
"myarray[a]" string => execresult("/usr/bin/ps -f | grep
$(mylist[c])","useshell");

 and so forth.

If you really need to operate processes, I'd rather suggest you using
process_select. If your task lays somewhere else, describe it more
clearly.

2010/5/14  <mega...@gmail.com>:
> For me, the following bundle:
>
> bundle agent atest {
>
> vars:
>
> "mylist[a]" string => "1";
> "mylist[b]" string => "2";
> "mylist[c]" string => "3";
>
> "mykeys" slist => getindices("mylist");
>
> "myarray[$(mykeys)]" string => execresult("/usr/bin/ps -f | grep
> $(mylist[$(mykeys)])","useshell");
> }
>
> Produces the following errors:
>
> $ cf-agent -KI -f ./testbundle.cf
> Truncating long file /opt/atws/files/BUILT4 in readfile to max limit 4
> !! Duplicate selection of value for variable "myarray[a]" in scope atest
> Rule from ./roles/vnc.cf at/before line 27
> !! Duplicate selection of value for variable "myarray[b]" in scope atest
> Rule from ./roles/vnc.cf at/before line 27
> !! Duplicate selection of value for variable "myarray[c]" in scope atest
> Rule from ./roles/vnc.cf at/before line 27
>
> Can anyone else replicate this? And/or tell me what the issue is?
>
> I am using stock 3.04 on Solaris10/SPARC.
>
> Cheers
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
>
>



-- 
SY, Seva Gluschenko.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to