On 07/07/2011 12:43 PM, romuald FREBAULT wrote:

has anyone an idea of how i could have managed files removed on destnation when removed from source without using the entierely purge function?

What you want is a /etc/cron.puppet.d and a way to link files there
into /etc/cron.d (cron supports symlinks).  And you want the symlinks
to track the contents of the directory.  That way you can use purge.

You could write a script that runs on the client that does that.
Run it from cron, or trigger with puppet.  Something like:

$ cat track-with-links
#! /bin/bash

m=master    # master directory
s=slave        # slave directory

for f in $( ls $s )
do
        [ ! -e $s/$f ] && echo removing $s/$f && rm -f $s/$f
done

for f in $( ls $m )
do
        [ ! -e $s/$f ] && echo adding $s/$f && ln -fs ../$m/$f $s/$f
done



here is a test session:

vagn@nika:~/tmp$ ls master/ slave/
master/:
baz

slave/:
baz
vagn@nika:~/tmp$ touch master/foo ; rm master/baz
vagn@nika:~/tmp$ ./track-with-links ; ls master/ slave/
removing slave/baz
adding slave/foo
master/:
foo

slave/:
foo
vagn@nika:~/tmp$


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to