Hi,

Scenarios is as follows:

1) /tmp/blafasel holds some files and subdirectories
2) /tmp/blafasel2 is a copy of /tmp/blafasel without the subdirectories, 
but with it's own subdirectories
3) cfengine is supposed to copy only the files to the other directory and 
purge files only (i.e. keep subdirectories of blafasel2)

4) with recurse=0, no files are copied at all
5) with recurse=1, files and the subdirs, but not the sub's content is 
copied, but subdirs are purged from the destination. This is undesired.
6) the next idea was to use a filter to only copy everything but 
directories. This works fine on the copy-side of things, but
7) when it comes to purging, the filter is ignored and subdirectories that 
do not exist in the source are purged (at least if they are empty)

I'm out of ideas on how to achieve this, but I'd say that if the copy 
command applies the filter, then the purge which is a subfunction of the 
copy should apply the filter, too and keep those directories.

# apt-cache show cfengine2
Package: cfengine2
Maintainer: Andrew Stribblehill <[EMAIL PROTECTED]>
Version: 2.1.20-1
Filename: pool/universe/c/cfengine2/cfengine2_2.1.20-1_i386.deb

Here is a dump of how the directories looked like before, the actusal 
cfagent run and how the directories looked like after the run.

Cheers,
Sven


[EMAIL PROTECTED]:/var/cfengine/inputs# ls -la /tmp/blafasel*
/tmp/blafasel:
insgesamt 16
drwxr-xr-x  3 root root 4096 2007-07-31 16:15 .
drwxrwxrwt 13 root root 8192 2007-07-31 16:10 ..
-rw-r--r--  1 root root    0 2007-07-31 16:15 copy_me
drwxr-xr-x  2 root root 4096 2007-07-31 15:11 dont_copy_me

/tmp/blafasel2:
insgesamt 16
drwxr-xr-x  3 root root 4096 2007-07-31 16:15 .
drwxrwxrwt 13 root root 8192 2007-07-31 16:10 ..
drwxr-xr-x  2 root root 4096 2007-07-31 16:14 keep_me


[EMAIL PROTECTED]:/var/cfengine/inputs# cat cf.copypurge
filters:

       { no_subdirs
       Type:      "file|reg|link|socket|fifo|door|char|block"  # ignore 
directories
       Result:    "Type"
       }
copy:
        any::
                /tmp/blafasel   dest=/tmp/blafasel2
                include=*
                filter=no_subdirs
                purge=true
                recurse=1
                backup=false

[EMAIL PROTECTED]:/var/cfengine/inputs# cfagent -v -q -K
...
Host name is: my-host.domain.de
Operating System Type is linux
Operating System Release is 2.6.20-16-generic
Architecture = i686
...
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 * (Changing context state to: main) *
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
...
Looking for an input file /var/lib/cfengine2/inputs/cfagent.conf
Looking for an input file cf.copypurge
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Purge detected in local (non-cfservd) file copy to file /tmp/blafasel2
!! Do not risk purge if source /tmp/blafasel is NFS mounted (see manual)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Finished with cfagent.conf
...
*********************************************************************
 Main Tree Sched: copy pass 1 @ Tue Jul 31 16:16:28 2007
*********************************************************************

Checking copy from localhost:/tmp/blafasel to /tmp/blafasel2
cfengine:my-host: (Destination purging enabled)
cfengine:my-host: /tmp/blafasel2/copy_me wasn't at destination (copying)
cfengine:my-host: Copying from localhost:/tmp/blafasel/copy_me
cfengine:my-host: Object /tmp/blafasel2/copy_me had permission 600, 
changed it to 644
cfengine:my-host: Purging /tmp/blafasel2/keep_me in copy dest directory
Saving the setuid log in 
/var/lib/cfengine2/cfagent.my-host.office.denic.de.log
...

[EMAIL PROTECTED]:/var/cfengine/inputs# ls -la /tmp/blafasel*
/tmp/blafasel:
insgesamt 16
drwxr-xr-x  3 root root 4096 2007-07-31 16:15 .
drwxrwxrwt 13 root root 8192 2007-07-31 16:10 ..
-rw-r--r--  1 root root    0 2007-07-31 16:15 copy_me
drwxr-xr-x  2 root root 4096 2007-07-31 15:11 dont_copy_me

/tmp/blafasel2:
insgesamt 12
drwxr-xr-x  2 root root 4096 2007-07-31 16:16 .
drwxrwxrwt 13 root root 8192 2007-07-31 16:10 ..
-rw-r--r--  1 root root    0 2007-07-31 16:16 copy_me

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to