{"action":"created","comment":{"url":"https://api.github.com/repos/Normation/rudder/pulls/comments/88170019","pull_request_review_id":8751056,"id":88170019,"diff_hunk":"@@ -0,0 +1,45 @@\n+\n+Generallity about Rudder Hooks\n+==============================\n+\n+Hooks must be executable file, typically scripts, whatever the language\n+as long they are self-executable (i.e: correct #! definition). \n+\n+Hooks must be name with the extension \".hook\". Any other extension will \n+be ignore (which allow to put other file in these directory, like a \n+readme, for example). \n+\n+Hooks are executed sequentially, in lexical order. We encourage\n+you to use the patter \"NN-hookname.ext.hook\", with NN a number like\n+\"05\", \"20\", etc. \n+\n+About node-policy-generated/ hooks\n+==================================\n+\n+When/What ?\n+-----------\n+\n+This directory contains hooks executed after poplicies are fully \n+generated for node, but before these new policies replace the old\n+one (technically, before we move /var/rudder/share/$NODEID/rules.new \n+to /var/rudder/share/$NODEID/rules).\n+\n+Typically, these hooks proceed to sanity checks on the new policies\n+(ex: cf-promises), update permission on files, or interect with\n+external services using knowledged from the generated policies \n+(ex: send node-properties JSON file to a third party service). \n+\n+Parameters ?\n+------------\n+Hooks parameter are passed by environment variable: \n+\n+- RUDDER_GENERATION_DATETIME    : generation datetime: ISO-8601 date/time that identify that policy generation start \n+- RUDDER_NODEID                 : the nodeId\n+- RUDDER_NEXT_POLICIES_DIRECTORY: new policies directory (ie /var/rudder/share/$NODEID/rules.new)\n+- RUDDER_AGENT_TYPE             : agent type (\"cfengine-nova\" or \"cfengine-community\")\n+","path":"rudder-core/src/main/resources/hooks.d/node-policy-generated/readme.txt","position":40,"original_position":40,"commit_id":"939cb03088b327623d8cf733afc00d965b37d2b6","original_commit_id":"939cb03088b327623d8cf733afc00d965b37d2b6","user":{"login":"armeniaca","id":12865615,"avatar_url":"https://avatars.githubusercontent.com/u/12865615?v=3","gravatar_id":"","url":"https://api.github.com/users/armeniaca","html_url":"https://github.com/armeniaca","followers_url":"https://api.github.com/users/armeniaca/followers","following_url":"https://api.github.com/users/armeniaca/following{/other_user}","gists_url":"https://api.github.com/users/armeniaca/gists{/gist_id}","starred_url":"https://api.github.com/users/armeniaca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armeniaca/subscriptions","organizations_url":"https://api.github.com/users/armeniaca/orgs","repos_url":"https://api.github.com/users/armeniaca/repos","events_url":"https://api.github.com/users/armeniaca/events{/privacy}","received_events_url":"https://api.github.com/users/armeniaca/received_events","type":"User","site_admin":false},"body":"Would it make sense to also add an env var about `$RUDDER_HOOK_NAME`? That could then include like `node-policy-generated`. This would help if you want to use a single binary/script (due to code/function reuse without splitting it up) by symlinking it to different hook dirs. This way you'd not need to parse `$0` go get the directory that was being used to call the script...","created_at":"2016-11-16T05:18:42Z","updated_at":"2016-11-16T05:18:42Z","html_url":"https://github.com/Normation/rudder/pull/1374#discussion_r88170019","pull_request_url":"https://api.github.com/repos/Normation/rudder/pulls/1374","_links":{"self":{"href":"https://api.github.com/repos/Normation/rudder/pulls/comments/88170019"},"html":{"href":"https://github.com/Normation/rudder/pull/1374#discussion_r88170019"},"pull_request":{"href":"https://api.github.com/repos/Normation/rudder/pulls/1374"}}},"pull_request":{"url":"https://api.github.com/repos/Normation/rudder/pulls/1374","id":93411876,"html_url":"https://github.com/Normation/rudder/pull/1374","diff_url":"https://github.com/Normation/rudder/pull/1374.diff","patch_url":"https://github.com/Normation/rudder/pull/1374.patch","issue_url":"https://api.github.com/repos/Normation/rudder/issues/1374","number":1374,"state":"open","locked":false,"title":"Fixes #8353: Implement notifications for different server-side actions and events (hooks)","user":{"login":"fanf","id":44649,"avatar_url":"https://avatars.githubusercontent.com/u/44649?v=3","gravatar_id":"","url":"https://api.github.com/users/fanf","html_url":"https://github.com/fanf","followers_url":"https://api.github.com/users/fanf/followers","following_url":"https://api.github.com/users/fanf/following{/other_user}","gists_url":"https://api.github.com/users/fanf/gists{/gist_id}","starred_url":"https://api.github.com/users/fanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanf/subscriptions","organizations_url":"https://api.github.com/users/fanf/orgs","repos_url":"https://api.github.com/users/fanf/repos","events_url":"https://api.github.com/users/fanf/events{/privacy}","received_events_url":"https://api.github.com/users/fanf/received_events","type":"User","site_admin":false},"body":"https://www.rudder-project.org/redmine/issues/8353","created_at":"2016-11-11T22:58:36Z","updated_at":"2016-11-16T05:18:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb27850cf4d74bc39d1c2bb61329f42c6abe9da7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Normation/rudder/pulls/1374/commits","review_comments_url":"https://api.github.com/repos/Normation/rudder/pulls/1374/comments","review_comment_url":"https://api.github.com/repos/Normation/rudder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Normation/rudder/issues/1374/comments","statuses_url":"https://api.github.com/repos/Normation/rudder/statuses/939cb03088b327623d8cf733afc00d965b37d2b6","head":{"label":"fanf:ust_8353/implement_notifications_for_different_server_side_actions_and_events_hooks","ref":"ust_8353/implement_notifications_for_different_server_side_actions_and_events_hooks","sha":"939cb03088b327623d8cf733afc00d965b37d2b6","user":{"login":"fanf","id":44649,"avatar_url":"https://avatars.githubusercontent.com/u/44649?v=3","gravatar_id":"","url":"https://api.github.com/users/fanf","html_url":"https://github.com/fanf","followers_url":"https://api.github.com/users/fanf/followers","following_url":"https://api.github.com/users/fanf/following{/other_user}","gists_url":"https://api.github.com/users/fanf/gists{/gist_id}","starred_url":"https://api.github.com/users/fanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanf/subscriptions","organizations_url":"https://api.github.com/users/fanf/orgs","repos_url":"https://api.github.com/users/fanf/repos","events_url":"https://api.github.com/users/fanf/events{/privacy}","received_events_url":"https://api.github.com/users/fanf/received_events","type":"User","site_admin":false},"repo":{"id":6705258,"name":"rudder","full_name":"fanf/rudder","owner":{"login":"fanf","id":44649,"avatar_url":"https://avatars.githubusercontent.com/u/44649?v=3","gravatar_id":"","url":"https://api.github.com/users/fanf","html_url":"https://github.com/fanf","followers_url":"https://api.github.com/users/fanf/followers","following_url":"https://api.github.com/users/fanf/following{/other_user}","gists_url":"https://api.github.com/users/fanf/gists{/gist_id}","starred_url":"https://api.github.com/users/fanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanf/subscriptions","organizations_url":"https://api.github.com/users/fanf/orgs","repos_url":"https://api.github.com/users/fanf/repos","events_url":"https://api.github.com/users/fanf/events{/privacy}","received_events_url":"https://api.github.com/users/fanf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fanf/rudder","description":null,"fork":true,"url":"https://api.github.com/repos/fanf/rudder","forks_url":"https://api.github.com/repos/fanf/rudder/forks","keys_url":"https://api.github.com/repos/fanf/rudder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fanf/rudder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fanf/rudder/teams","hooks_url":"https://api.github.com/repos/fanf/rudder/hooks","issue_events_url":"https://api.github.com/repos/fanf/rudder/issues/events{/number}","events_url":"https://api.github.com/repos/fanf/rudder/events","assignees_url":"https://api.github.com/repos/fanf/rudder/assignees{/user}","branches_url":"https://api.github.com/repos/fanf/rudder/branches{/branch}","tags_url":"https://api.github.com/repos/fanf/rudder/tags","blobs_url":"https://api.github.com/repos/fanf/rudder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fanf/rudder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fanf/rudder/git/refs{/sha}","trees_url":"https://api.github.com/repos/fanf/rudder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fanf/rudder/statuses/{sha}","languages_url":"https://api.github.com/repos/fanf/rudder/languages","stargazers_url":"https://api.github.com/repos/fanf/rudder/stargazers","contributors_url":"https://api.github.com/repos/fanf/rudder/contributors","subscribers_url":"https://api.github.com/repos/fanf/rudder/subscribers","subscription_url":"https://api.github.com/repos/fanf/rudder/subscription","commits_url":"https://api.github.com/repos/fanf/rudder/commits{/sha}","git_commits_url":"https://api.github.com/repos/fanf/rudder/git/commits{/sha}","comments_url":"https://api.github.com/repos/fanf/rudder/comments{/number}","issue_comment_url":"https://api.github.com/repos/fanf/rudder/issues/comments{/number}","contents_url":"https://api.github.com/repos/fanf/rudder/contents/{+path}","compare_url":"https://api.github.com/repos/fanf/rudder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fanf/rudder/merges","archive_url":"https://api.github.com/repos/fanf/rudder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fanf/rudder/downloads","issues_url":"https://api.github.com/repos/fanf/rudder/issues{/number}","pulls_url":"https://api.github.com/repos/fanf/rudder/pulls{/number}","milestones_url":"https://api.github.com/repos/fanf/rudder/milestones{/number}","notifications_url":"https://api.github.com/repos/fanf/rudder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fanf/rudder/labels{/name}","releases_url":"https://api.github.com/repos/fanf/rudder/releases{/id}","deployments_url":"https://api.github.com/repos/fanf/rudder/deployments","created_at":"2012-11-15T13:39:53Z","updated_at":"2014-06-06T15:06:41Z","pushed_at":"2016-11-15T17:10:29Z","git_url":"git://github.com/fanf/rudder.git","ssh_url":"git@github.com:fanf/rudder.git","clone_url":"https://github.com/fanf/rudder.git","svn_url":"https://github.com/fanf/rudder","homepage":"http://www.rudder-project.org/","size":24517,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Normation:master","ref":"master","sha":"5545b68b80c5beb35bd47a49d0aca90679825fea","user":{"login":"Normation","id":695105,"avatar_url":"https://avatars.githubusercontent.com/u/695105?v=3","gravatar_id":"","url":"https://api.github.com/users/Normation","html_url":"https://github.com/Normation","followers_url":"https://api.github.com/users/Normation/followers","following_url":"https://api.github.com/users/Normation/following{/other_user}","gists_url":"https://api.github.com/users/Normation/gists{/gist_id}","starred_url":"https://api.github.com/users/Normation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Normation/subscriptions","organizations_url":"https://api.github.com/users/Normation/orgs","repos_url":"https://api.github.com/users/Normation/repos","events_url":"https://api.github.com/users/Normation/events{/privacy}","received_events_url":"https://api.github.com/users/Normation/received_events","type":"Organization","site_admin":false},"repo":{"id":2528254,"name":"rudder","full_name":"Normation/rudder","owner":{"login":"Normation","id":695105,"avatar_url":"https://avatars.githubusercontent.com/u/695105?v=3","gravatar_id":"","url":"https://api.github.com/users/Normation","html_url":"https://github.com/Normation","followers_url":"https://api.github.com/users/Normation/followers","following_url":"https://api.github.com/users/Normation/following{/other_user}","gists_url":"https://api.github.com/users/Normation/gists{/gist_id}","starred_url":"https://api.github.com/users/Normation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Normation/subscriptions","organizations_url":"https://api.github.com/users/Normation/orgs","repos_url":"https://api.github.com/users/Normation/repos","events_url":"https://api.github.com/users/Normation/events{/privacy}","received_events_url":"https://api.github.com/users/Normation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Normation/rudder","description":"Continuous configuration for effective compliance","fork":false,"url":"https://api.github.com/repos/Normation/rudder","forks_url":"https://api.github.com/repos/Normation/rudder/forks","keys_url":"https://api.github.com/repos/Normation/rudder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Normation/rudder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Normation/rudder/teams","hooks_url":"https://api.github.com/repos/Normation/rudder/hooks","issue_events_url":"https://api.github.com/repos/Normation/rudder/issues/events{/number}","events_url":"https://api.github.com/repos/Normation/rudder/events","assignees_url":"https://api.github.com/repos/Normation/rudder/assignees{/user}","branches_url":"https://api.github.com/repos/Normation/rudder/branches{/branch}","tags_url":"https://api.github.com/repos/Normation/rudder/tags","blobs_url":"https://api.github.com/repos/Normation/rudder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Normation/rudder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Normation/rudder/git/refs{/sha}","trees_url":"https://api.github.com/repos/Normation/rudder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Normation/rudder/statuses/{sha}","languages_url":"https://api.github.com/repos/Normation/rudder/languages","stargazers_url":"https://api.github.com/repos/Normation/rudder/stargazers","contributors_url":"https://api.github.com/repos/Normation/rudder/contributors","subscribers_url":"https://api.github.com/repos/Normation/rudder/subscribers","subscription_url":"https://api.github.com/repos/Normation/rudder/subscription","commits_url":"https://api.github.com/repos/Normation/rudder/commits{/sha}","git_commits_url":"https://api.github.com/repos/Normation/rudder/git/commits{/sha}","comments_url":"https://api.github.com/repos/Normation/rudder/comments{/number}","issue_comment_url":"https://api.github.com/repos/Normation/rudder/issues/comments{/number}","contents_url":"https://api.github.com/repos/Normation/rudder/contents/{+path}","compare_url":"https://api.github.com/repos/Normation/rudder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Normation/rudder/merges","archive_url":"https://api.github.com/repos/Normation/rudder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Normation/rudder/downloads","issues_url":"https://api.github.com/repos/Normation/rudder/issues{/number}","pulls_url":"https://api.github.com/repos/Normation/rudder/pulls{/number}","milestones_url":"https://api.github.com/repos/Normation/rudder/milestones{/number}","notifications_url":"https://api.github.com/repos/Normation/rudder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Normation/rudder/labels{/name}","releases_url":"https://api.github.com/repos/Normation/rudder/releases{/id}","deployments_url":"https://api.github.com/repos/Normation/rudder/deployments","created_at":"2011-10-06T19:27:50Z","updated_at":"2016-11-15T19:37:38Z","pushed_at":"2016-11-15T17:10:30Z","git_url":"git://github.com/Normation/rudder.git","ssh_url":"git@github.com:Normation/rudder.git","clone_url":"https://github.com/Normation/rudder.git","svn_url":"https://github.com/Normation/rudder","homepage":"http://www.rudder-project.org/","size":23616,"stargazers_count":104,"watchers_count":104,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":4,"forks":23,"open_issues":4,"watchers":104,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Normation/rudder/pulls/1374"},"html":{"href":"https://github.com/Normation/rudder/pull/1374"},"issue":{"href":"https://api.github.com/repos/Normation/rudder/issues/1374"},"comments":{"href":"https://api.github.com/repos/Normation/rudder/issues/1374/comments"},"review_comments":{"href":"https://api.github.com/repos/Normation/rudder/pulls/1374/comments"},"review_comment":{"href":"https://api.github.com/repos/Normation/rudder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Normation/rudder/pulls/1374/commits"},"statuses":{"href":"https://api.github.com/repos/Normation/rudder/statuses/939cb03088b327623d8cf733afc00d965b37d2b6"}}}}
{"actor":{"display_login":"armeniaca"}}