Forum: CFEngine Help Subject: Overwrite file with link in copy_from Author: FraserCampbell Link to topic: https://cfengine.com/forum/read.php?3,27574,27574#msg-27574
I'm trying to replicate directory contents using copy_from but am running into an issue with links. The source directory contains some links which are should replace legacy files in the current destination. My copy_from body has type_check => "false" and purge => "true" but it's not sufficient, CFEngine refuses to overwrite the file with a link. Here is the compaint issued by cf-agent: cf3> -> Destination file "/var/tmp/dest/link" already exists cf3> Checksum comparison replaced by ctime: files not regular cf3> !! Image file /var/tmp/dest/link has a wrong digest/checksum (should be copy of /var/tmp/source/link) cf3> Checking link from /var/tmp/dest/link to file cf3> !! Object /var/tmp/dest/link exists and is obstructing our promise cf3> !! Unable to create link /var/tmp/dest/link -> ./file Here is a sample source and destination: root@test:/var/tmp # ls -l /var/tmp/dest /var/tmp/source /var/tmp/source: total 2 -rw-r--r-- 1 root root 0 Sep 26 13:38 file lrwxrwxrwx 1 root root 4 Sep 26 13:38 link -> file /var/tmp/dest: total 0 -rw-r--r-- 1 root root 0 Sep 26 13:38 file -rw-r--r-- 1 root root 0 Sep 26 13:38 link And here is the bundle I'm using to test: bundle agent test { files: any:: "/var/tmp/dest" copy_from => my_cp("/var/tmp/source"), depth_search => recurse("inf"); } body copy_from my_cp(from) { source => "${from}"; compare => "digest"; verify => "false"; type_check => "false"; copy_backup => "false"; purge => "true"; } body depth_search recurse(d) { depth => "$(d)"; xdev => "true"; } Any suggestions? Thanks, Fraser _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine