On 06/03/2012 01:17, Nick Anderson wrote:
> On 03/05/2012 06:10 PM, Aleksey Tsalolikhin wrote:
>> On Mon, Mar 5, 2012 at 3:28 PM, Nick Anderson<n...@cmdln.org>  wrote:
>>> On 03/05/2012 04:33 PM, Daniel V. Klein wrote:
>>>> It is pretty hard to determine what you did wrong when you haven't shared 
>>>> what you did...
>>> Well I included a gist link to the code.
>>>
>>> But Aleksey also commented that replace_or_add wasn't included in it, so
>>> I have attached the example policy and in-lined all of the parts from
>>> the stdlib that are required.
>> I imagine Dan and I have older versions of cfengine_stdlib.cf -- mine
>> does not have replace_or_add in it, and it is version
>>
>> # Subversion : $Rev: 53 $
>> # For Cfengine Core: 3.1.0
> I am running 3.2.1, with copbl rev 110.
>
> Also I expect that replace to complain about not being convergent since
> the value to replace with still matches the regex, but it usually still
> works. I think its the dots in the existing string that might be causing
> the issue but they should just be gobbled up by the .* in the regex.
>
>
I believe it's because the line you are matching (HOSTNAME=node1) is 
present, and the regexp matching the search line is not anchored to the 
end of the line
Using this regexp solved the issue :
"^(?!$(line)$)$(pattern)$"

(note the extra $ after line)

I think the cfengine_stdlib should be corrected to avoid this bug.

Thank you for finding this, Nick

Regards,
Nicolas
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to