Ok, so I tried using the purge option below.  I then deleted one of the html 
files and waited for the deletion to propagate which didn't happen.  Is purge 
an option that only works if you are copying whole directories?  I noticed in 
the cfengine doc it says it can only be used in conjunction with a depth_search 
option.

bundle agent webserve_config
{
  classes:
    "fooweb" and => {"cflax01"};

  packages:
   fooweb::
    "httpd"
        package_policy => "add",
        package_method => yum;
  
  commands:
   fooweb::
    "/sbin/chkconfig" args => "httpd on";
    "/sbin/service"   args => "httpd start";

  files:
   fooweb::
    "/var/www/html/foo.html"
        copy_from => 
webcopy("/var/cfengine/masterfiles/fooweb/var/www/html/foo.html", "cfengsrv "),
        perms => u_p("644"),
        #depth_search => links,
        action => u_immediate;
    "/var/www/html/test.html"
        copy_from => webcopy("/var/cfengine/masterfiles/foolink/test.html", 
"cfengsrv "),
        perms => u_p("644"),
        depth_search => links,
        action => u_immediate;
    "/var/www/html/foo2.html"
        copy_from => 
webcopy("/var/cfengine/masterfiles/fooweb/var/www/html/foo2.html", "cfengsrv "),
        perms => u_p("644"),
        action => u_immediate;
        #depth_search => recurse("inf");
        
}

body depth_search links
{
  traverse_links => "true";
}

body copy_from webcopy(from,server)
{
servers     => {"$(server)"};
source      => "$(from)";
compare     => "digest";
copy_backup => "true";
trustkey    => "true";
purge       => "true";
}

-----Original Message-----
From: help-cfengine-boun...@cfengine.org 
[mailto:help-cfengine-boun...@cfengine.org] On Behalf Of Sjoerd Oostdijck
Sent: Thursday, May 19, 2011 9:10 AM
To: help-cfengine@cfengine.org
Subject: Re: Automatically deleting files on nodes

On 5/19/11 2:58 PM, Scott Dobner wrote:
> Hi,
> I am trying to manage a webserver using CFEngine, and one of the 
> problems I have run into is that I cannot seem to find a way to delete 
> a file automatically when I remove it from the server.  Is there some 
> kind of attribute of a file promise that checks if a file is present 
> on the server and then deletes it if it is deleted from the server?
>  
Yup, you can define

body copy_from example {
     purge => "true";
}

-- 
Sjoerd Oostdijck                  RIPE Network Coordination Centre
RIPE NCC, IT Department                  Singel 258, Amsterdam, NL
http://www.ripe.net                                +31 20 535 4444

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


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

Reply via email to