Forum: Cfengine Help Subject: Re: ex_list and purge conflict? Author: hartikka Link to topic: https://cfengine.com/forum/read.php?3,20878,20961#msg-20961
Hi Niel, Thanks for your time. I think I have what I want... Here is the end goal: 1) I want cfengine controlling a directory 'zzz'. I think I have that. 2) Next, I want cfengine to remove any file in zzz that is not in the corresponding zzz in the masterfiles. In general, the user is not allowed to add files to zzz. I think I use 'purge' for that - and I think I have it working. 3) Finally, I want to allow the file zzz/free to change. This is an exception - the user is allowed to change this file. I thought I should I use 'ex_list'() for this sort of thing. I tried this... bundle agent maintainMe { ... vars: "setup_excludes" slist => { "\.pv", "\.pt", "\.eq", "PRES\.cq"}; ... files: "/home/me/setup/" copy_from => mycopy("$(masters)/setup","localhost"), file_select => ex_list("@(setup_excludes)"), ... } body copy_from mycopy(from, server) { ... purge => "true"; # remove extra files ... } It seems to me now that I have to use 'anchored' RE's. "setup_excludes" slist => { ".*\.pv", ".*\.pt", ".*\.eq", ".*PRES.cq"}; End of end goal. And it seems to be attained. Does that make sense? Regarding my last: It occurred to me that if I omitted the ex_list() and instead did this: host> ln -s zzz/free masterfiles/zzz/free ... then I could change zzz/free and cfengine could only give me the changed one whatever it thought. This looks kind of loopy. Scary even. I don't like it. I would like it even less if my masterfiles were on a remote machine - which, in the end, they will be. I very much prefer to learn how to properly express my end goal in native cfengine language. End of about my last. I wonder now: Can ex_list() can be told to exclude files that match in one directory and not in another directory? Thank you again. Best, Ron _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine