On Feb 9, 2010, at 5:55 PM, Andrew J. Millar wrote:

> 
> 
> If I add in depth_search include_basedir => "true", it changes the permissions
> recursively, which isn't what I want. How can I make this apply only to the
> directory I've specified in the same way it works fine for the authorized_key
> file?
> 

Might be something like this following;

bundle agent test
{
 files:
  "/root"
    create => "true",
    perms => m("700"),
    file_select => folder(".ssh"),
    depth_search => recurse("1");
   
  "/root/.ssh/authorized_keys"
    create => "true",
    perms => m("600");
}

body file_select folder(regex)
{
 leaf_name  => { ".*$(regex)$"};
 file_result => "leaf_name";
}

body perms m(mode)
{
 mode => "$(mode)";
}

body depth_search recurse(d)
{
 depth => "$(d)";
}


> 
> I'm guessing there's no other way to do it than to create a new body type such
> as the following, but just wanted some confirmation?
> 
> body file_select filetype_excluding(type,exclude)
> {
> file_types  => { "$(type)" };
> leaf_name  => { "$(exclude)"};
> file_result => "file_types&!leaf_name";
> }

It should be fine. You should try and see. :-)

Cheers,
--Nakarin

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to