{"action":"created","comment":{"url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/comments/81483201","pull_request_review_id":2459948,"id":81483201,"diff_hunk":"@@ -0,0 +1,99 @@\n+#\n+# Cookbook Name:: splunk\n+# Recipe:: setup_shclustering\n+#\n+# Author: Ryan LeViseur <ryanlev@gmail.com>\n+# Copyright (c) 2014, Chef Software, Inc <legal@chef.io>\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#    http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+unless node['splunk']['shclustering']['enabled']\n+  Chef::Log.debug('The chef-splunk::setup_shclustering recipe was added to the node,')\n+  Chef::Log.debug('but the attribute to enable search head clustering was not set.')\n+  return\n+end\n+\n+# ensure that the splunk service resource is available without cloning\n+# the resource (CHEF-3694). this is so the later notification works,\n+# especially when using chefspec to run this cookbook's specs.\n+begin\n+  resources('service[splunk]')\n+rescue Chef::Exceptions::ResourceNotFound\n+  service 'splunk'\n+end\n+\n+include_recipe 'chef-vault'\n+\n+passwords = chef_vault_item('vault', \"splunk_#{node.chef_environment}\")\n+splunk_auth_info = passwords['auth']\n+shcluster_secret = passwords['shcluster_secret'] || node['splunk']['shclustering']['shcluster_secret']\n+shcluster_params = node['splunk']['shclustering']\n+\n+# unless shcluster members are staticly assigned via the node attribute,\n+# try to find the other shcluster members via Chef search\n+if shcluster_params['shcluster_members'].empty?\n+\tshcluster_servers_list = Array.new\n+\tsearch( # ~FC003\n+\t  :node,\n+\t  \"\\\n+\t  splunk_shclustering_enabled:true AND \\\n+\t  splunk_shclustering_label:#{node['splunk']['shclustering']['label']} AND \\\n+\t  chef_environment:#{node.chef_environment}\"\n+\t).each do |result|\n+\t\tshcluster_servers_list << result['splunk']['shclustering']['mgmt_uri']\n+\tend\n+else\n+\tshcluster_servers_list = shcluster_params['shcluster_members'].join(',')\n+end\n+\n+# create app directories to house our server.conf with our shcluster configuration\n+shcluster_app_dir = \"#{splunk_dir}/etc/apps/0_autogen_shcluster_config\"\n+\n+directory \"#{shcluster_app_dir}\" do\n+\towner node['splunk']['user']['username']\n+  group node['splunk']['user']['username']\n+  mode 0755\n+end\n+\n+directory \"#{shcluster_app_dir}/local\" do\n+\towner node['splunk']['user']['username']\n+  group node['splunk']['user']['username']\n+  mode 0755\n+end\n+\n+template \"#{shcluster_app_dir}/local/server.conf\" do\n+\tsource \"shclustering/server.conf.erb\"\n+\tmode 0755","path":"recipes/setup_shclustering.rb","position":76,"original_position":76,"commit_id":"4413953e8db3e66551be68b6e80d923cd0766bb2","original_commit_id":"4413953e8db3e66551be68b6e80d923cd0766bb2","user":{"login":"rarsan","id":926390,"avatar_url":"https://avatars.githubusercontent.com/u/926390?v=3","gravatar_id":"","url":"https://api.github.com/users/rarsan","html_url":"https://github.com/rarsan","followers_url":"https://api.github.com/users/rarsan/followers","following_url":"https://api.github.com/users/rarsan/following{/other_user}","gists_url":"https://api.github.com/users/rarsan/gists{/gist_id}","starred_url":"https://api.github.com/users/rarsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rarsan/subscriptions","organizations_url":"https://api.github.com/users/rarsan/orgs","repos_url":"https://api.github.com/users/rarsan/repos","events_url":"https://api.github.com/users/rarsan/events{/privacy}","received_events_url":"https://api.github.com/users/rarsan/received_events","type":"User","site_admin":false},"body":"I think mode 600 is appropriate permissions here","created_at":"2016-10-03T01:27:05Z","updated_at":"2016-10-03T01:27:25Z","html_url":"https://github.com/chef-cookbooks/chef-splunk/pull/82#discussion_r81483201","pull_request_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82","_links":{"self":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/comments/81483201"},"html":{"href":"https://github.com/chef-cookbooks/chef-splunk/pull/82#discussion_r81483201"},"pull_request":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82"}}},"pull_request":{"url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82","id":83337714,"html_url":"https://github.com/chef-cookbooks/chef-splunk/pull/82","diff_url":"https://github.com/chef-cookbooks/chef-splunk/pull/82.diff","patch_url":"https://github.com/chef-cookbooks/chef-splunk/pull/82.patch","issue_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/82","number":82,"state":"open","locked":false,"title":"Searchhead clustering","user":{"login":"vidkun","id":627820,"avatar_url":"https://avatars.githubusercontent.com/u/627820?v=3","gravatar_id":"","url":"https://api.github.com/users/vidkun","html_url":"https://github.com/vidkun","followers_url":"https://api.github.com/users/vidkun/followers","following_url":"https://api.github.com/users/vidkun/following{/other_user}","gists_url":"https://api.github.com/users/vidkun/gists{/gist_id}","starred_url":"https://api.github.com/users/vidkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidkun/subscriptions","organizations_url":"https://api.github.com/users/vidkun/orgs","repos_url":"https://api.github.com/users/vidkun/repos","events_url":"https://api.github.com/users/vidkun/events{/privacy}","received_events_url":"https://api.github.com/users/vidkun/received_events","type":"User","site_admin":false},"body":"This implements the ability to configure search head clustering and initiate the captain election process.\r\n\r\nUsage is documented in the README and additional information regarding search head clustering can be found in the [Splunk Docs](http://docs.splunk.com/Documentation/Splunk/latest/DistSearch/AboutSHC)","created_at":"2016-08-30T20:06:04Z","updated_at":"2016-10-03T01:41:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e66771cd33c8fe8b6e96af122c2b9b3022f7109f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82/commits","review_comments_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82/comments","review_comment_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/82/comments","statuses_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/statuses/4413953e8db3e66551be68b6e80d923cd0766bb2","head":{"label":"vidkun:searchhead_clustering","ref":"searchhead_clustering","sha":"4413953e8db3e66551be68b6e80d923cd0766bb2","user":{"login":"vidkun","id":627820,"avatar_url":"https://avatars.githubusercontent.com/u/627820?v=3","gravatar_id":"","url":"https://api.github.com/users/vidkun","html_url":"https://github.com/vidkun","followers_url":"https://api.github.com/users/vidkun/followers","following_url":"https://api.github.com/users/vidkun/following{/other_user}","gists_url":"https://api.github.com/users/vidkun/gists{/gist_id}","starred_url":"https://api.github.com/users/vidkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidkun/subscriptions","organizations_url":"https://api.github.com/users/vidkun/orgs","repos_url":"https://api.github.com/users/vidkun/repos","events_url":"https://api.github.com/users/vidkun/events{/privacy}","received_events_url":"https://api.github.com/users/vidkun/received_events","type":"User","site_admin":false},"repo":{"id":64393687,"name":"chef-splunk","full_name":"vidkun/chef-splunk","owner":{"login":"vidkun","id":627820,"avatar_url":"https://avatars.githubusercontent.com/u/627820?v=3","gravatar_id":"","url":"https://api.github.com/users/vidkun","html_url":"https://github.com/vidkun","followers_url":"https://api.github.com/users/vidkun/followers","following_url":"https://api.github.com/users/vidkun/following{/other_user}","gists_url":"https://api.github.com/users/vidkun/gists{/gist_id}","starred_url":"https://api.github.com/users/vidkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vidkun/subscriptions","organizations_url":"https://api.github.com/users/vidkun/orgs","repos_url":"https://api.github.com/users/vidkun/repos","events_url":"https://api.github.com/users/vidkun/events{/privacy}","received_events_url":"https://api.github.com/users/vidkun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vidkun/chef-splunk","description":"Development repository for Chef's Splunk cookbook","fork":true,"url":"https://api.github.com/repos/vidkun/chef-splunk","forks_url":"https://api.github.com/repos/vidkun/chef-splunk/forks","keys_url":"https://api.github.com/repos/vidkun/chef-splunk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vidkun/chef-splunk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vidkun/chef-splunk/teams","hooks_url":"https://api.github.com/repos/vidkun/chef-splunk/hooks","issue_events_url":"https://api.github.com/repos/vidkun/chef-splunk/issues/events{/number}","events_url":"https://api.github.com/repos/vidkun/chef-splunk/events","assignees_url":"https://api.github.com/repos/vidkun/chef-splunk/assignees{/user}","branches_url":"https://api.github.com/repos/vidkun/chef-splunk/branches{/branch}","tags_url":"https://api.github.com/repos/vidkun/chef-splunk/tags","blobs_url":"https://api.github.com/repos/vidkun/chef-splunk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vidkun/chef-splunk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vidkun/chef-splunk/git/refs{/sha}","trees_url":"https://api.github.com/repos/vidkun/chef-splunk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vidkun/chef-splunk/statuses/{sha}","languages_url":"https://api.github.com/repos/vidkun/chef-splunk/languages","stargazers_url":"https://api.github.com/repos/vidkun/chef-splunk/stargazers","contributors_url":"https://api.github.com/repos/vidkun/chef-splunk/contributors","subscribers_url":"https://api.github.com/repos/vidkun/chef-splunk/subscribers","subscription_url":"https://api.github.com/repos/vidkun/chef-splunk/subscription","commits_url":"https://api.github.com/repos/vidkun/chef-splunk/commits{/sha}","git_commits_url":"https://api.github.com/repos/vidkun/chef-splunk/git/commits{/sha}","comments_url":"https://api.github.com/repos/vidkun/chef-splunk/comments{/number}","issue_comment_url":"https://api.github.com/repos/vidkun/chef-splunk/issues/comments{/number}","contents_url":"https://api.github.com/repos/vidkun/chef-splunk/contents/{+path}","compare_url":"https://api.github.com/repos/vidkun/chef-splunk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vidkun/chef-splunk/merges","archive_url":"https://api.github.com/repos/vidkun/chef-splunk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vidkun/chef-splunk/downloads","issues_url":"https://api.github.com/repos/vidkun/chef-splunk/issues{/number}","pulls_url":"https://api.github.com/repos/vidkun/chef-splunk/pulls{/number}","milestones_url":"https://api.github.com/repos/vidkun/chef-splunk/milestones{/number}","notifications_url":"https://api.github.com/repos/vidkun/chef-splunk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vidkun/chef-splunk/labels{/name}","releases_url":"https://api.github.com/repos/vidkun/chef-splunk/releases{/id}","deployments_url":"https://api.github.com/repos/vidkun/chef-splunk/deployments","created_at":"2016-07-28T12:28:35Z","updated_at":"2016-07-28T12:28:36Z","pushed_at":"2016-08-30T19:54:42Z","git_url":"git://github.com/vidkun/chef-splunk.git","ssh_url":"git@github.com:vidkun/chef-splunk.git","clone_url":"https://github.com/vidkun/chef-splunk.git","svn_url":"https://github.com/vidkun/chef-splunk","homepage":"https://supermarket.chef.io/cookbooks/chef-splunk","size":474,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"chef-cookbooks:master","ref":"master","sha":"f49c6e65283b19d61da70c3c4401c3073a36d0da","user":{"login":"chef-cookbooks","id":3617830,"avatar_url":"https://avatars.githubusercontent.com/u/3617830?v=3","gravatar_id":"","url":"https://api.github.com/users/chef-cookbooks","html_url":"https://github.com/chef-cookbooks","followers_url":"https://api.github.com/users/chef-cookbooks/followers","following_url":"https://api.github.com/users/chef-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/chef-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/chef-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/chef-cookbooks/orgs","repos_url":"https://api.github.com/users/chef-cookbooks/repos","events_url":"https://api.github.com/users/chef-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/chef-cookbooks/received_events","type":"Organization","site_admin":false},"repo":{"id":15814426,"name":"chef-splunk","full_name":"chef-cookbooks/chef-splunk","owner":{"login":"chef-cookbooks","id":3617830,"avatar_url":"https://avatars.githubusercontent.com/u/3617830?v=3","gravatar_id":"","url":"https://api.github.com/users/chef-cookbooks","html_url":"https://github.com/chef-cookbooks","followers_url":"https://api.github.com/users/chef-cookbooks/followers","following_url":"https://api.github.com/users/chef-cookbooks/following{/other_user}","gists_url":"https://api.github.com/users/chef-cookbooks/gists{/gist_id}","starred_url":"https://api.github.com/users/chef-cookbooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef-cookbooks/subscriptions","organizations_url":"https://api.github.com/users/chef-cookbooks/orgs","repos_url":"https://api.github.com/users/chef-cookbooks/repos","events_url":"https://api.github.com/users/chef-cookbooks/events{/privacy}","received_events_url":"https://api.github.com/users/chef-cookbooks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chef-cookbooks/chef-splunk","description":"Development repository for Chef's Splunk cookbook","fork":false,"url":"https://api.github.com/repos/chef-cookbooks/chef-splunk","forks_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/forks","keys_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/teams","hooks_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/hooks","issue_events_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/events{/number}","events_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/events","assignees_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/assignees{/user}","branches_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/branches{/branch}","tags_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/tags","blobs_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/git/refs{/sha}","trees_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/statuses/{sha}","languages_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/languages","stargazers_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/stargazers","contributors_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/contributors","subscribers_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/subscribers","subscription_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/subscription","commits_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/commits{/sha}","git_commits_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/git/commits{/sha}","comments_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/comments{/number}","issue_comment_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/comments{/number}","contents_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/contents/{+path}","compare_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/merges","archive_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/downloads","issues_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues{/number}","pulls_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls{/number}","milestones_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/milestones{/number}","notifications_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/labels{/name}","releases_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/releases{/id}","deployments_url":"https://api.github.com/repos/chef-cookbooks/chef-splunk/deployments","created_at":"2014-01-11T01:14:21Z","updated_at":"2016-09-22T18:50:28Z","pushed_at":"2016-09-08T20:26:54Z","git_url":"git://github.com/chef-cookbooks/chef-splunk.git","ssh_url":"git@github.com:chef-cookbooks/chef-splunk.git","clone_url":"https://github.com/chef-cookbooks/chef-splunk.git","svn_url":"https://github.com/chef-cookbooks/chef-splunk","homepage":"https://supermarket.chef.io/cookbooks/chef-splunk","size":578,"stargazers_count":37,"watchers_count":37,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":22,"forks":72,"open_issues":22,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82"},"html":{"href":"https://github.com/chef-cookbooks/chef-splunk/pull/82"},"issue":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/82"},"comments":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/chef-cookbooks/chef-splunk/statuses/4413953e8db3e66551be68b6e80d923cd0766bb2"}}}}
{"actor":{"display_login":"rarsan"}}