Wow - I just did a sanity check to see if cfengine 3.1.0 can even
iterate over a simple list with only 1 item (i.e. nothing to do with
readstringlist.). Something like:

bundle agent atest {
vars:
    "sl" slist => { "oneitem" };
reports:
    agent::
    ">>$(sl)";
}

And it didnt work. Nothing was printed out. I put two items in the
list and it works all of a sudden. Can someone tell me I'm crazy or
making some stupid mistake...?



On Thu, Nov 11, 2010 at 7:46 AM, Michael Potter <mega...@gmail.com> wrote:
> Ah I see what you did now, smart. And strange that it works one way
> but not the other...
>
> On Thu, Nov 11, 2010 at 1:45 AM, Daniel V. Klein <d...@lonewolf.com> wrote:
>> No, I mean it does the sum() correctly and second report, but it doesn't do 
>> the first report
>>
>> I also added this to the bug tracker for you...
>>
>> -Dan
>>
>> On Nov 9, 2010, at 9:52 PM, Michael Potter wrote:
>>
>>> On Wed, Nov 10, 2010 at 4:49 PM, Daniel V. Klein <d...@lonewolf.com> wrote:
>>>> Good catch, Michael - but here's the weird bit - it turns out that the 
>>>> list is actually there, you just can't iterate over it!
>>>
>>>
>>> You mean the variable is defined but empty? I wasn't quite sure...
>>>
>>>>
>>>> -Dan
>>>>
>>>> body common control {
>>>>   bundlesequence => { setup, atest };
>>>>   version        => "0.01";
>>>> }
>>>>
>>>> bundle agent setup {
>>>>
>>>> files:
>>>>
>>>>    "/tmp/foo" create => "true", edit_line => maketest;
>>>> }
>>>>
>>>> bundle edit_line maketest {
>>>>
>>>> insert_lines:
>>>>
>>>>    "123";
>>>> #    "qaz";
>>>> }
>>>>
>>>> bundle agent atest {
>>>>
>>>> vars:
>>>>
>>>>    "words"  slist => readstringlist("/tmp/foo","#.*","NoWayJose",99,9999);
>>>>    "sum" real => sum("words");
>>>>
>>>> reports:
>>>>
>>>>    agent::
>>>>
>>>>    ">>$(words)";
>>>>    "sum>>$(sum)";
>>>> }
>>>>
>>>>
>>>> On Nov 9, 2010, at 3:22 PM, Michael Potter wrote:
>>>>
>>>>> It seems that readstringlist in 3.1.0 has trouble reading a single
>>>>> word/line from a file. The attached self-enclosed bundle will create a
>>>>> file /tmp/foo with a single word in it. If you run it under 3.0.5, it
>>>>> successfully reads that single word and reports on it. Under 3.1.0, it
>>>>> is not able to extract the word from the file. Note that if multiple
>>>>> lines/words are added to the file, 3.1.0 *is* able to extract the
>>>>> words.
>>>>>
>>>>> Do others see the same thing? Is there a way to write the separator
>>>>> regex such that it works under 3.1.0?
>>>>> <atest.cf>_______________________________________________
>>>>> Help-cfengine mailing list
>>>>> Help-cfengine@cfengine.org
>>>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>>>
>>>>
>>
>>
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to