How to notify resources when config file changed?


#1

Ohai!

We’re modifying a configuration file based on chef attributes (it’s not a
template and cannot be made into one atm) and would like to notify other
resources if the content has changed (ie. restart services)

Has someone already written stuff for this (that works on Windows :-)??

I guess one method would be to create a temp file and compare with the
existing and only move temp file into place if they differ…

/Jeppe


#2

Chef provides file checksum related functionalities as separate modules,
you can write an lwrp where thr provider can mixin the checksum
functionality and use the updated_by_last_action as per your logic. You can
use this resource to do the notications
On Jun 21, 2013 5:03 AM, “Jeppe Nejsum Madsen” jeppe@ingolfs.dk wrote:

Ohai!

We’re modifying a configuration file based on chef attributes (it’s not a
template and cannot be made into one atm) and would like to notify other
resources if the content has changed (ie. restart services)

Has someone already written stuff for this (that works on Windows :-)??

I guess one method would be to create a temp file and compare with the
existing and only move temp file into place if they differ…

/Jeppe