I have started running cfengine3, using cf-execd to schedule runs of cf-agent at the default interval of every 5 minutes.
cf-execd captures the output of cf-agent (which is run with the --inform option), storing the output in the $WORKDIR/outputs directory, and also emailing the result (but only if it differs to the last run). As you might imagine, with an output file every 5 minutes, this directory will quickly fill up with a large number of files, and it is expected that the user cleans up this directory.
I created a rule which will delete these output files that are more than 3 days old, however the problem this creates is every output will be different to the previous one (as a new file will be deleted each time), hence an email will be sent. So I go from lots of files in the outputs dir, to lots of emails in my inbox!
What I would really like is to suppress messages when certain promises are repaired, particularly the one which deletes files in the outputs directory. It would essentially negate the -I option for that promise only. Alternatively, if I could change the time boundary from being from 'now' to a fixed point (say every Wednesday), I could at least restrict the number of emails down to one a week.
It looks like you never got an answer to your question, so I'm posting this now in the spirit of "better late than never".
You asked:
As far as I know, it is not possible to negate the --inform switch for a single promise.
This can be achieved using the "ifelapsed" parameter - this gives a minimum frequency with which to run a promise. Consider this example:
Or you could just run this promise on Wednesdays, using the special class. I prefer the
ifelapsed
approach, which doesn't rely on a weekday (you never know if that host might not be running one Wednesday...), like this:Actually I came to an even simpler answer - don't run cf-agent with --inform.
Just let cf-engine do it's thing and don't try and keep track of what repairs are being made, the main concern is the system has arrived in a desired state, not how it got there.
This may seem an anathema to a change management regime that wants to track every change to the system in excruciating detail, however I have found it is the only mindset that allows one to use cf-engine whilst remaining sane.
Of course, your answer was strictly the correct one to the question I posed, which is why I ticked it.
In my 'inherited' deployment, I found that there was a
garbage_collection
bundle already insite.cf
, but it was not called from anywhere. I need to add it the bundle sequence inpromises.cf
Not sure if this would be the case in a new deployment; if so, you perhaps need to update your promises (I know I need to)
Hope it helps, Cameron