help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles question


From: Ed Brown
Subject: Re: editfiles question
Date: Wed, 01 Sep 2004 09:27:04 -0600

Right.  No root line, no editing.  Useful for setting the root passwd in
/etc/shadow, where if there's not an entry for root, something is pretty
seriously wrong.  Guess I didn't read your requirements carefully
enough.
 


On Wed, 2004-09-01 at 09:00, Sven Mueller wrote:
> Ed Brown [u] wrote on 01/09/2004 16:44:
> 
> > Here's another approach:
> > 
> > editfiles:
> >    { /etc/whatever
> >           BeginGroupIfNoLineMatching "root:$1raboof:4875::::::"
> >                  LocateLineMatching "^root:.*"
> >                  ReplaceLineWith "root:$1raboof:4875::::::"
> >           EndGroup
> >    }
> 
> Wouldn't that approach replace some other line if no line matching 
> "^root:.*" was found while no line matching "root:$1raboof:4875::::::" 
> existed before?
> Hmm, no, according to the documentation, if LocateLineMatching doesn't 
> find a match, it aborts any further editing. So your approach will only 
> replace existing lines, but if none matching "root:.*" is found, it 
> won't do anything.
> 
> cu,
> sven




reply via email to

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