Thanks, Seva.  I'm afraid that does not work either:

[cfengine00  ~]# cf-agent -f ./test.cf
R: /var/spool/cron/crontabs/root
R: $(g.myusers)
R: $(g.mylist)
[cfengine00  ~]# more test.cf

body common control {
        bundlesequence => {"runme"};
}

bundle common g
{
vars:

   "crontab" string => "/var/spool/cron/crontabs/root";

vars:
    "myusers"  slist => { "joe", "mary", "ann" };

}


bundle agent runme

{
vars: "mylist" slist => { @(g.myusers) };

reports:
linux::
  "$(g.crontab)";
  "$(g.myusers)";
  "$(g.mylist)";
}
[cfengine00  ~]#

Please advise.


On Sat, May 28, 2011 at 3:08 AM, Seva Gluschenko
<seva.glusche...@gmail.com> wrote:
> Aleksey,
>
> one cannot iterate over foreign slist. You need to make a local copy:
> bundle agent runme
> {
>  vars:
>   "myusers" slist => { @(g.myusers) };
> ...
> }
>
> 2011/5/28 Aleksey Tsalolikhin <atsaloli.t...@gmail.com>:
>> What's wrong with this picture?
>>
>> I am trying to loop over the contents of @(myusers)
>>
>> I want to create home directories and add entries to /etc/sudoers
>>
>> However, I am unable to access the slist for an implicit loop:
>>
>> ------------------------------------------------
>> body common control {
>>        bundlesequence => {"runme"};
>> }
>>
>> bundle common g
>> {
>> vars:
>>
>>   "crontab" string => "/var/spool/cron/crontabs/root";
>>
>> vars:
>>    "myusers"  slist => { "joe", "mary", "ann" };
>>
>> }
>>
>>
>> bundle agent runme
>>
>> {
>> reports:
>> linux::
>>  "$(g.crontab)";
>>  "$(g.myusers)";
>> }
>> ------------------------------------------------
>>
>> [cfengine00  ~]# cf-agent -f ./test.cf
>> R: /var/spool/cron/crontabs/root
>> R: $(g.myusers)
>> [cfengine00  ~]#
>>
>> How do I loop over the g.myusers slist?
>>
>> Thanks,
>> -at
>> _______________________________________________
>> 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