help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles problem - revisited


From: Sven Mueller
Subject: Re: editfiles problem - revisited
Date: Thu, 02 Sep 2004 16:00:47 +0200
User-agent: Thunderbird 0.7.3 (Windows/20040803)

Josef Wolf [u] wrote on 02/09/2004 14:25:

On Thu, Sep 02, 2004 at 01:52:12PM +0200, Sven Mueller wrote:


test:x:1:1::/tmp/:/bin/bash
test2:x:2:2::/tmp/:/bin/bash

Here is what cfagent.conf looks like:

control:
       actionsequence = ( editfiles )

editfiles:
       { /tmp/passwd
               Backup "Off"
               SplitOn ":"
               ReplaceLinesMatchingField 1
               SetLine "test::::::"
               AppendIfNoLineMatching "ThisLine"
       }


AFAICS, the ThisLine notation works only in a ForEachLineIn loop.  You need
to give a regexp to AppendIfNoLineMatching.  Further, ReplaceLinesMatching
requires either a ForEachLineIn loop or a SetLine.
So please try:

         { /tmp/passwd
                 Backup "Off"
                 SplitOn ":"
                 SetLine "test::::::"
                 ReplaceLinesMatchingField 1
                 AppendIfNoLineMatching "test:.*"
         }

Changing it this way still doesn't replace an existing "test:x:1:1::/tmp/:/bin/bash" line with the "test::::::" line.

It doesn't seem to matter wether the ReplaceLinesMatchingField instruction is given before or after SetLine. It doesn't do what the documentation suggests in either case.

cu,
sven



reply via email to

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