Forum: Cfengine Help
Subject: simple file copy problem
Author: schattenfell
Link to topic: https://cfengine.com/forum/read.php?3,22319,22319#msg-22319

Hello,

at the moment I am facing a problem with copying files under cfengine3 I did 
not have under cfengine2.

Scenario:

I want to copy some files from my policy host to different Clients:


      "/usr/local/sbin"
         comment     => "copy root scripts for $(sys.fqhost)",
         copy_from   => copy("${v.datadir}/usr/local/sbin"),
         perms       => file("root", "root", "0770"),
         depth_search => recursion("inf");


To copy all of them with one statement I use recursion. The problem that now 
occurs with that promise is, that all files in the destiny directory are set to 
the given rules (u:root, g:root, m:0770), not only the files copied. I know 
this is by design, but how can I handle this only for that files copied?

One way would be to make single promises for every file and copy it:


      "/usr/local/sbin/file1"
         comment     => "copy root scripts for $(sys.fqhost)",
         copy_from   => copy("${v.datadir}/usr/local/sbin/file1"),
         perms       => file("root", "root", "0770");

      "/usr/local/sbin/file2"
         comment     => "copy root scripts for $(sys.fqhost)",
         copy_from   => copy("${v.datadir}/usr/local/sbin/file2"),
         perms       => file("root", "root", "0770");
      
      [...]


Is there a better way to fullfill my intention? I don't want to make that for 
hundreds of files.

Best wishes
Michael

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

Reply via email to