That would do exactly what I want but it seems fileexists() wants to see only a fully qualified file name - regex’s don’t work. I need to use a regex because the only information I have is that a file in the directory will match \w.*
On Aug 26, 2012, at 8:36 AM, Aleksey Tsalolikhin wrote: > Classes: "somefilesthere" > Expression => fileexists(...); > > Reports: > Somefilesthere:: > "Report text"; > > How's that? > On Aug 25, 2012 10:33 PM, "Aleksey Tsalolikhin" <atsaloli.t...@gmail.com> > wrote: > Hi Abid. Check out the fileexists() function. You can use it to set a class > which you can link to a reports promise. > > Yours, > Aleksey > > On Aug 25, 2012 9:03 AM, "Abid Khwaja" <a...@tyrann.net> wrote: > I’m running community 3.2.3. > > My goal is to notify a group of non-technical users whenever there are files > in a particular directory - the normal state is that the directory should be > empty. I’m currently doing this via the following: > > bundle agent main > { > files: > “/apps/myApp_files/errors/time/.*" > file_select => plain, > delete => tidy, > action => warn_only; > } > > I’m using “delete => tidy” only because I need something to attach the > “action” attribute to - I never actually want to ever delete or touch any of > the files in the directory. Is this the smartest way to achieve what I want? > > Also, while the above works, it’s not optimal because you get a lot of text > in the warn message that non-technical users don’t understand. A better way > would be to define a class if any files are found in the directory and use > that class in a reports section to send out a more easier to understand > message. How would I define such a class? > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine