Fixes #5097 Add logic to handle hooks in ncf

http://www.rudder-project.org/redmine/issues/5097