{"action":"created","comment":{"url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/comments/79387333","id":79387333,"diff_hunk":"@@ -0,0 +1,41 @@\n+module LogglyHelpers\n+  def configure_files(original_files)\n+    valid_files(original_files).map(&:to_h).map do |file|\n+      file['tag'] ||= File.basename(file['filename']).tr('.', '-')\n+      file['statefile'] ||= \"#{file['filename']}.rsyslog_state\"\n+      file\n+    end\n+  end\n+\n+  private def valid_files(original_files)\n+    original_files.reject do |file|\n+      !file.is_a?(Hash) || file['filename'].to_s.strip.empty?\n+    end\n+  end\n+\n+  def loggly_format(app_name)\n+    app_name_initial_caps = app_name.to_s.gsub(/\\b(?<!['â`])[a-z]/, &:capitalize)\n+    \"LogglyFormat#{app_name_initial_caps}\"\n+  end\n+\n+  def tags\n+    (node.loggly.tags || []).map { |tag| \"tag=\\\\\\\"#{tag}\\\\\\\"\" }.join(' ')\n+  end\n+\n+  def rsyslog_major_version\n+    version_cmd = Mixlib::ShellOut.new('rpm -q rsyslog')\n+    version_cmd.run_command\n+    response = version_cmd.stdout.chomp\n+    # will return something like rsyslog-5.8.10-10.el6_6.x86_64\n+    response.match(/^rsyslog-(\\d+)/)[1].to_i\n+  end\n+\n+  def set_version6_source(template, source_file)\n+    resource = run_context.resource_collection.find(template: template)\n+    resource.source(source_file)","path":"libraries/loggly_helpers.rb","position":null,"original_position":35,"commit_id":"18188d809eeabfe827941b4e6aa0a51eb57ce4c3","original_commit_id":"ad22633a6f939b4b5f4d4d03d1ed620434e15645","user":{"login":"squaresurf","id":863076,"avatar_url":"https://avatars.githubusercontent.com/u/863076?v=3","gravatar_id":"","url":"https://api.github.com/users/squaresurf","html_url":"https://github.com/squaresurf","followers_url":"https://api.github.com/users/squaresurf/followers","following_url":"https://api.github.com/users/squaresurf/following{/other_user}","gists_url":"https://api.github.com/users/squaresurf/gists{/gist_id}","starred_url":"https://api.github.com/users/squaresurf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squaresurf/subscriptions","organizations_url":"https://api.github.com/users/squaresurf/orgs","repos_url":"https://api.github.com/users/squaresurf/repos","events_url":"https://api.github.com/users/squaresurf/events{/privacy}","received_events_url":"https://api.github.com/users/squaresurf/received_events","type":"User","site_admin":false},"body":"You shouldn't need to worry about a `user-provided` value for attributes as long as we just define the `default`.  There are quite a few ways to override defaults with the [attribute precedence](https://docs.chef.io/attributes.html#attribute-precedence).\r\n\r\nPlease set the default for Ubuntu 14.04 to what it would be if this PR was not merged as I know that it is working for Ubuntu 14.04 off of master.","created_at":"2016-09-19T13:14:41Z","updated_at":"2016-09-19T13:14:41Z","html_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7#discussion_r79387333","pull_request_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/comments/79387333"},"html":{"href":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7#discussion_r79387333"},"pull_request":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7","id":85114173,"html_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7","diff_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7.diff","patch_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7.patch","issue_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/7","number":7,"state":"open","locked":false,"title":"wip - Add apps support","user":{"login":"vhladama","id":378428,"avatar_url":"https://avatars.githubusercontent.com/u/378428?v=3","gravatar_id":"","url":"https://api.github.com/users/vhladama","html_url":"https://github.com/vhladama","followers_url":"https://api.github.com/users/vhladama/followers","following_url":"https://api.github.com/users/vhladama/following{/other_user}","gists_url":"https://api.github.com/users/vhladama/gists{/gist_id}","starred_url":"https://api.github.com/users/vhladama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhladama/subscriptions","organizations_url":"https://api.github.com/users/vhladama/orgs","repos_url":"https://api.github.com/users/vhladama/repos","events_url":"https://api.github.com/users/vhladama/events{/privacy}","received_events_url":"https://api.github.com/users/vhladama/received_events","type":"User","site_admin":false},"body":"I need to update the README to explain the \"apps\" concept before this can be merged.","created_at":"2016-09-13T19:56:12Z","updated_at":"2016-09-19T13:14:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c9928bc719b288c36b56daf1136b40bde7ebb5b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7/commits","review_comments_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7/comments","review_comment_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/7/comments","statuses_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/statuses/18188d809eeabfe827941b4e6aa0a51eb57ce4c3","head":{"label":"vhl:add_apps_support","ref":"add_apps_support","sha":"18188d809eeabfe827941b4e6aa0a51eb57ce4c3","user":{"login":"vhl","id":1626375,"avatar_url":"https://avatars.githubusercontent.com/u/1626375?v=3","gravatar_id":"","url":"https://api.github.com/users/vhl","html_url":"https://github.com/vhl","followers_url":"https://api.github.com/users/vhl/followers","following_url":"https://api.github.com/users/vhl/following{/other_user}","gists_url":"https://api.github.com/users/vhl/gists{/gist_id}","starred_url":"https://api.github.com/users/vhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhl/subscriptions","organizations_url":"https://api.github.com/users/vhl/orgs","repos_url":"https://api.github.com/users/vhl/repos","events_url":"https://api.github.com/users/vhl/events{/privacy}","received_events_url":"https://api.github.com/users/vhl/received_events","type":"Organization","site_admin":false},"repo":{"id":67534857,"name":"vhl_loggly_rsyslog-cookbook","full_name":"vhl/vhl_loggly_rsyslog-cookbook","owner":{"login":"vhl","id":1626375,"avatar_url":"https://avatars.githubusercontent.com/u/1626375?v=3","gravatar_id":"","url":"https://api.github.com/users/vhl","html_url":"https://github.com/vhl","followers_url":"https://api.github.com/users/vhl/followers","following_url":"https://api.github.com/users/vhl/following{/other_user}","gists_url":"https://api.github.com/users/vhl/gists{/gist_id}","starred_url":"https://api.github.com/users/vhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhl/subscriptions","organizations_url":"https://api.github.com/users/vhl/orgs","repos_url":"https://api.github.com/users/vhl/repos","events_url":"https://api.github.com/users/vhl/events{/privacy}","received_events_url":"https://api.github.com/users/vhl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vhl/vhl_loggly_rsyslog-cookbook","description":"Chef cookbook to configure rsyslog to send logs to Loggly","fork":true,"url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook","forks_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/forks","keys_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/teams","hooks_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/hooks","issue_events_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/issues/events{/number}","events_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/events","assignees_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/assignees{/user}","branches_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/branches{/branch}","tags_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/tags","blobs_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/statuses/{sha}","languages_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/languages","stargazers_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/stargazers","contributors_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/contributors","subscribers_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/subscribers","subscription_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/subscription","commits_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/contents/{+path}","compare_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/merges","archive_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/downloads","issues_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/issues{/number}","pulls_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/pulls{/number}","milestones_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/milestones{/number}","notifications_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/labels{/name}","releases_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/releases{/id}","deployments_url":"https://api.github.com/repos/vhl/vhl_loggly_rsyslog-cookbook/deployments","created_at":"2016-09-06T18:18:33Z","updated_at":"2016-09-06T18:18:47Z","pushed_at":"2016-09-19T11:51:57Z","git_url":"git://github.com/vhl/vhl_loggly_rsyslog-cookbook.git","ssh_url":"git@github.com:vhl/vhl_loggly_rsyslog-cookbook.git","clone_url":"https://github.com/vhl/vhl_loggly_rsyslog-cookbook.git","svn_url":"https://github.com/vhl/vhl_loggly_rsyslog-cookbook","homepage":null,"size":81,"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":"spartansystems:master","ref":"master","sha":"f75855e6cea680787f93698c32080362b575bf94","user":{"login":"spartansystems","id":5521793,"avatar_url":"https://avatars.githubusercontent.com/u/5521793?v=3","gravatar_id":"","url":"https://api.github.com/users/spartansystems","html_url":"https://github.com/spartansystems","followers_url":"https://api.github.com/users/spartansystems/followers","following_url":"https://api.github.com/users/spartansystems/following{/other_user}","gists_url":"https://api.github.com/users/spartansystems/gists{/gist_id}","starred_url":"https://api.github.com/users/spartansystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spartansystems/subscriptions","organizations_url":"https://api.github.com/users/spartansystems/orgs","repos_url":"https://api.github.com/users/spartansystems/repos","events_url":"https://api.github.com/users/spartansystems/events{/privacy}","received_events_url":"https://api.github.com/users/spartansystems/received_events","type":"Organization","site_admin":false},"repo":{"id":53090637,"name":"spartan_loggly_rsyslog-cookbook","full_name":"spartansystems/spartan_loggly_rsyslog-cookbook","owner":{"login":"spartansystems","id":5521793,"avatar_url":"https://avatars.githubusercontent.com/u/5521793?v=3","gravatar_id":"","url":"https://api.github.com/users/spartansystems","html_url":"https://github.com/spartansystems","followers_url":"https://api.github.com/users/spartansystems/followers","following_url":"https://api.github.com/users/spartansystems/following{/other_user}","gists_url":"https://api.github.com/users/spartansystems/gists{/gist_id}","starred_url":"https://api.github.com/users/spartansystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spartansystems/subscriptions","organizations_url":"https://api.github.com/users/spartansystems/orgs","repos_url":"https://api.github.com/users/spartansystems/repos","events_url":"https://api.github.com/users/spartansystems/events{/privacy}","received_events_url":"https://api.github.com/users/spartansystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook","description":"Chef cookbook to configure rsyslog to send logs to Loggly","fork":true,"url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook","forks_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/forks","keys_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/teams","hooks_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/hooks","issue_events_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/events{/number}","events_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/events","assignees_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/assignees{/user}","branches_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/branches{/branch}","tags_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/tags","blobs_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/statuses/{sha}","languages_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/languages","stargazers_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/stargazers","contributors_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/contributors","subscribers_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/subscribers","subscription_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/subscription","commits_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/contents/{+path}","compare_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/merges","archive_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/downloads","issues_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues{/number}","pulls_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls{/number}","milestones_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/milestones{/number}","notifications_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/labels{/name}","releases_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/releases{/id}","deployments_url":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/deployments","created_at":"2016-03-03T23:02:19Z","updated_at":"2016-03-04T22:55:07Z","pushed_at":"2016-09-19T11:51:58Z","git_url":"git://github.com/spartansystems/spartan_loggly_rsyslog-cookbook.git","ssh_url":"git@github.com:spartansystems/spartan_loggly_rsyslog-cookbook.git","clone_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook.git","svn_url":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook","homepage":null,"size":64,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7"},"html":{"href":"https://github.com/spartansystems/spartan_loggly_rsyslog-cookbook/pull/7"},"issue":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/7"},"comments":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/spartansystems/spartan_loggly_rsyslog-cookbook/statuses/18188d809eeabfe827941b4e6aa0a51eb57ce4c3"}}}}
{"actor":{"display_login":"squaresurf"}}