On Aug 28, 2012, at 8:50 PM, Aleksey Tsalolikhin <atsaloli.t...@gmail.com> wrote:
> Try this, it's more native to CFEngine, though I still use an external > command to report the detected file. > > # Report all files in directory /tmp/. matching regex pattern \w.* > > bundle agent example > > { > files: > > "/tmp/." > > file_select => files_we_care_about, > transformer => "/bin/echo DETECTED $(this.promiser)", > depth_search => recurse("inf"); > > } > > ############################################ > > body file_select files_we_care_about > > { > > leaf_name => { "\w.*" }; # leaf_name = regex to match > against file name > file_result => "leaf_name"; > } > > ############################################ > > body depth_search recurse(d) > > { > depth => "$(d)"; > } > Thanks! I needed a way to set a class if a directory wasn’t empty and use that class in a reports: section because we like to send everything to syslog from which notifications get routed to the appropriate parties. Intuitively, I assumed filexists() would accept a regex. It would be good to find out the reasoning behind why fileexists() doesn’t allow regexs. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine