I wrote this quick hack a while back as a proof of concept that hooks
chefs file/template resources to register an Inotify watch.
Caveat: This code is not prod worthy don’t run it anywhere except for
something that you feel fine breaking
The intent was just to see what overhead all the chef file stats and
checks were, and weather I could make the system use a notification system
for on disk changes vs poll.
The implementation is only 1/2 complete. I am not hooking the chef-server
side of reporting a change. Which is where I would like some feedback on
how to go about doing this? I was looking into the checksum generation and
such. I am wondering if theres a way I can get the list of files that were
modified in a cookbook from the server in the normal run ?. Ideally this
would then trigger the flag that the watch was dirty, and causes chef to
run the full file converge. Also just looking for any feed back in general
int weather this is insane or useful. I didn’t have a need for it. Just had
some curiosity about weather it could be hacked into chef easy or not.
On a test node where I ran this with 10k false files my runtime was
reduced from 10s to < 2s on runs where no change was taken. (this was a
contrived test with a loop around a file resource with some content).