help-cfengine
[Top][All Lists]
Advanced

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

Iteration in editfiles <= progress!


From: Chip Seraphine
Subject: Iteration in editfiles <= progress!
Date: Tue, 24 Jun 2003 12:26:08 -0500
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.2.1) Gecko/20030121


Although the cfengine-reference does not mention it, I have discovered
that it is possible to use editfiles on a directory, using the same
syntax as files:.  It works fine, but it dumps a lot of errors:

control:
        actionsequence  = ( editfiles )

editfiles:
        { /tmp/test
                Repository "off"
                Recurse "3"
                Include "testfile"
                AppendIfNoSuchLine "Testing"
        }

The above results in all files name "testfile" 3 levels or less down
under /tmp/test to have the line "Testing" added to them.  The only
problem is that I get this (at -d2):

Begin editing /tmp/test/foo/bar/testfile
Edit action: Repository
cfengine:cuffs: Unknown action in editing of file /tmp/test/foo/bar/testfile
Edit action: Recurse
cfengine:cuffs: Unknown action in editing of file /tmp/test/foo/bar/testfile
Edit action: Include
Edit action: AppendIfNoSuchLine
End editing /tmp/test/foo/bar/testfile

The actions are handled elsewhere, but the actual editing is confused by
the recursion commands.  Again, it edits the files just fine; the only
problem is the "Unknown action in editing of file" messages it spits out.

Is editfiles-recursion an undocumented feature and I should be happy it
works as well as it does, or is it something everybody already knew
about and there is a bug that generates the 'spurious' error messages?


Chip Seraphine wrote:
I am trying to use cfengine to distribute SSH keys and am attempting to
do as much as possible within cfengine (as opposed to modules or
shellouts).  Editfiles seems ideal, since I can use the AppendIfWhatever
stuff to add a key only when and where it is really needed.

The problem is getting the operation performed on an arbitrary list of
files (e.g. keys for various users).  An iterator would be perfect since
I can put the users in:a:list:like:this easily enough, but the iteration
doesn't seem to work in an editfiles path like this:

{ /home/$(user)/.ssh/whatever
    blah...
}

Short of something extreme (such as using m4 to autogenerate a cfengine
file on the fly), how can I get editfiles to run on a list of files
determined only at runtime?  Any ideas would be appreciated.



_______________________________________________
Help-cfengine mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-cfengine







reply via email to

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