help-cfengine
[Top][All Lists]
Advanced

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

Re: files and existance of the file


From: Knut Auvor Grythe
Subject: Re: files and existance of the file
Date: Sun, 3 Jul 2005 19:52:52 +0200
User-agent: Mutt/1.5.6i

On Sun, Jul 03, 2005 at 12:30:02PM -0500, Lance Albertson wrote:
> Currently, I'm wanting to make sure a file in all the home directories
> is a specific permission. The problem is, the file may not exist so
> cfengine should just ignore it. When that happens I always get output of
> it simliar to this:
> 
> cfengine:host: Directory /home/foouser/.foo cannot be accessed in files
> 
> Is there a missing option I can use to make this work or is this just
> the nature of cfengine?

Couldn't you just do it recursively? Something like this:

    files:
        any::
            /home/*/.foo 
            recurse=1 action=fixall
            m=644

Not sure if recurse should be 1 or 2 (I don't know where it starts
counting). Haven't tested, and it depends on your directory structure
for directories anyway. I just googled it and found the example in
http://cclib.nsu.ru/projects/gnudocs/gnudocs/cfengine/cfengine_35.html

If the recursion isn't what you want, maybe you could do a test in
groups and use it afterwards? Like this:

    groups:
        any::
            foo_exists = ( FileExists(/home/foouser/.foo) )

    files:
        foo_exists::
            /home/foouser/.foo
            m=644

That way, the rule in files would only be run on existing files.

Hope this helps. I'm not quite sure what you are doing, so this advice
might not fit your situation :-)

-- 
Knut Auvor Grythe
ITEA Systemdrift




reply via email to

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