help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LocateLineMatching madness


From: Alexander Jolk
Subject: Re: LocateLineMatching madness
Date: Wed, 05 May 2004 14:40:04 +0200

Oyvind Gronnesby wrote:
> editfiles:
>     software_slapd::
>         { /etc/ldap/ldap.conf
>             BeginGroupIfNoLineMatching "^URI ldap://localhost/";
>                 LocateLineMatching "URI"
>                 ReplaceLineWith "URI ldap://localhost/";
>             EndGroup

cfengine's regular expressions match the whole line; that is, as if
there were implicitly a ^ in front and a $ at the end of the line.  Your
regexp was probably meant to read
        LocateLineMatching "URI.*"

Also, this configuration fails if there isn't already a line starting
with `URI'.  The most elegant solution proposed so far seems to be

BeginGroupIfNoLineMatching "URI.*"
        Append "URI dummy"
EndGroup
# now we're sure a line URI exists...
ResetSearch "1"
LocateLineMatching "URI .*"
ReplaceLineWith "URI ldap://localhost/";

Alex

-- 
Alexander Jolk         /         BUF Compagnie
tel +33-1 42 68 18 28 /  fax +33-1 42 68 18 29




reply via email to

[Prev in Thread] Current Thread [Next in Thread]