{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/comments/61306718","id":61306718,"diff_hunk":"@@ -0,0 +1,79 @@\n+# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2\n+#\n+# Copyright (c) 2016-present, Facebook, Inc.\n+# All rights reserved.\n+#\n+# This source code is licensed under the BSD-style license found in the\n+# LICENSE file in the root directory of this source tree. An additional grant\n+# of patent rights can be found in the PATENTS file in the same directory.\n+#\n+\n+def whyrun_supported?\n+  true\n+end\n+\n+use_inline_resources\n+\n+action :run do\n+  repos = []\n+  mirror = node['fb_apt']['mirror']\n+  distro = node['lsb']['codename']\n+\n+  # only add base repos if mirror is set and codename is available\n+  if mirror && distro\n+    components = %w{main}\n+    if node.ubuntu?\n+      components << 'universe'\n+    end\n+\n+    if node['fb_apt']['want_non_free']\n+      if node.debian?\n+        components += %w{contrib non-free}\n+      elsif node.ubuntu?\n+        components += %w{restricted multiverse}\n+      else\n+        fail \"Don't know how to setup non-free for #{node['platform']}\"\n+      end\n+    end\n+\n+    components_entry = components.join(' ')\n+    base_repos = [\n+      # Main repo\n+      \"#{mirror} #{distro} #{components_entry}\",\n+    ]\n+\n+    # Security updates\n+    if node.debian? && distro != 'sid'\n+      base_repos <<\n+        \"http://security.debian.org/ #{distro}/updates #{components_entry}\"\n+    elsif node.ubuntu?\n+      base_repos <<\n+        \"http://security.ubuntu.com/ #{distro}-security #{components_entry}\"\n+    end\n+\n+    # Stable updates\n+    base_repos << \"#{mirror} #{distro}-updates #{components_entry}\"\n+\n+    if node['fb_apt']['want_backports']\n+      base_repos << \"#{mirror} #{distro}-backports #{components_entry}\"\n+    end\n+\n+    base_repos.each do |repo|\n+      repos << \"deb #{repo}\"\n+      if node['fb_apt']['want_source']\n+        repos << \"deb-src #{repo}\"\n+      end\n+    end\n+  end\n+\n+  # add custom repos\n+  repos += node['fb_apt']['repos']\n+\n+  template '/etc/apt/sources.list' do\n+    source 'sources.list.erb'\n+    owner 'root'\n+    group 'root'\n+    mode '0644'\n+    variables(:repos => repos)","path":"fb_apt/providers/sources_list.rb","position":77,"original_position":77,"commit_id":"8d300dcde3f4bb73ce8f9bb6e16a42289e51f6d8","original_commit_id":"8d300dcde3f4bb73ce8f9bb6e16a42289e51f6d8","user":{"login":"jaymzh","id":938467,"avatar_url":"https://avatars.githubusercontent.com/u/938467?v=3","gravatar_id":"","url":"https://api.github.com/users/jaymzh","html_url":"https://github.com/jaymzh","followers_url":"https://api.github.com/users/jaymzh/followers","following_url":"https://api.github.com/users/jaymzh/following{/other_user}","gists_url":"https://api.github.com/users/jaymzh/gists{/gist_id}","starred_url":"https://api.github.com/users/jaymzh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaymzh/subscriptions","organizations_url":"https://api.github.com/users/jaymzh/orgs","repos_url":"https://api.github.com/users/jaymzh/repos","events_url":"https://api.github.com/users/jaymzh/events{/privacy}","received_events_url":"https://api.github.com/users/jaymzh/received_events","type":"User","site_admin":false},"body":"don't use variables, please ","created_at":"2016-04-27T18:02:14Z","updated_at":"2016-04-27T18:02:14Z","html_url":"https://github.com/facebook/chef-cookbooks/pull/1#discussion_r61306718","pull_request_url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/comments/61306718"},"html":{"href":"https://github.com/facebook/chef-cookbooks/pull/1#discussion_r61306718"},"pull_request":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1","id":66722747,"html_url":"https://github.com/facebook/chef-cookbooks/pull/1","diff_url":"https://github.com/facebook/chef-cookbooks/pull/1.diff","patch_url":"https://github.com/facebook/chef-cookbooks/pull/1.patch","issue_url":"https://api.github.com/repos/facebook/chef-cookbooks/issues/1","number":1,"state":"open","locked":false,"title":"add fb_apt cookbook","user":{"login":"davide125","id":397089,"avatar_url":"https://avatars.githubusercontent.com/u/397089?v=3","gravatar_id":"","url":"https://api.github.com/users/davide125","html_url":"https://github.com/davide125","followers_url":"https://api.github.com/users/davide125/followers","following_url":"https://api.github.com/users/davide125/following{/other_user}","gists_url":"https://api.github.com/users/davide125/gists{/gist_id}","starred_url":"https://api.github.com/users/davide125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davide125/subscriptions","organizations_url":"https://api.github.com/users/davide125/orgs","repos_url":"https://api.github.com/users/davide125/repos","events_url":"https://api.github.com/users/davide125/events{/privacy}","received_events_url":"https://api.github.com/users/davide125/received_events","type":"User","site_admin":false},"body":"This adds a cookbook to manage APT using the attribute-driven API. It's a rework of an unpublished cookbook I've been running at home for a while. It tries to fully manage everything around APT, including keys and configurations. Tested only on Debian but includes code to support Ubuntu as well; should be trivial to port to other Debian-based distros.","created_at":"2016-04-16T01:01:02Z","updated_at":"2016-04-27T18:02:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71a71f6613171d07283e6846525e36e37cf93cef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1/commits","review_comments_url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1/comments","review_comment_url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/chef-cookbooks/issues/1/comments","statuses_url":"https://api.github.com/repos/facebook/chef-cookbooks/statuses/8d300dcde3f4bb73ce8f9bb6e16a42289e51f6d8","head":{"label":"davide125:master","ref":"master","sha":"8d300dcde3f4bb73ce8f9bb6e16a42289e51f6d8","user":{"login":"davide125","id":397089,"avatar_url":"https://avatars.githubusercontent.com/u/397089?v=3","gravatar_id":"","url":"https://api.github.com/users/davide125","html_url":"https://github.com/davide125","followers_url":"https://api.github.com/users/davide125/followers","following_url":"https://api.github.com/users/davide125/following{/other_user}","gists_url":"https://api.github.com/users/davide125/gists{/gist_id}","starred_url":"https://api.github.com/users/davide125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davide125/subscriptions","organizations_url":"https://api.github.com/users/davide125/orgs","repos_url":"https://api.github.com/users/davide125/repos","events_url":"https://api.github.com/users/davide125/events{/privacy}","received_events_url":"https://api.github.com/users/davide125/received_events","type":"User","site_admin":false},"repo":{"id":56357129,"name":"chef-cookbooks","full_name":"davide125/chef-cookbooks","owner":{"login":"davide125","id":397089,"avatar_url":"https://avatars.githubusercontent.com/u/397089?v=3","gravatar_id":"","url":"https://api.github.com/users/davide125","html_url":"https://github.com/davide125","followers_url":"https://api.github.com/users/davide125/followers","following_url":"https://api.github.com/users/davide125/following{/other_user}","gists_url":"https://api.github.com/users/davide125/gists{/gist_id}","starred_url":"https://api.github.com/users/davide125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davide125/subscriptions","organizations_url":"https://api.github.com/users/davide125/orgs","repos_url":"https://api.github.com/users/davide125/repos","events_url":"https://api.github.com/users/davide125/events{/privacy}","received_events_url":"https://api.github.com/users/davide125/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davide125/chef-cookbooks","description":"Open source chef cookbooks.","fork":true,"url":"https://api.github.com/repos/davide125/chef-cookbooks","forks_url":"https://api.github.com/repos/davide125/chef-cookbooks/forks","keys_url":"https://api.github.com/repos/davide125/chef-cookbooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davide125/chef-cookbooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davide125/chef-cookbooks/teams","hooks_url":"https://api.github.com/repos/davide125/chef-cookbooks/hooks","issue_events_url":"https://api.github.com/repos/davide125/chef-cookbooks/issues/events{/number}","events_url":"https://api.github.com/repos/davide125/chef-cookbooks/events","assignees_url":"https://api.github.com/repos/davide125/chef-cookbooks/assignees{/user}","branches_url":"https://api.github.com/repos/davide125/chef-cookbooks/branches{/branch}","tags_url":"https://api.github.com/repos/davide125/chef-cookbooks/tags","blobs_url":"https://api.github.com/repos/davide125/chef-cookbooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davide125/chef-cookbooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davide125/chef-cookbooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/davide125/chef-cookbooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davide125/chef-cookbooks/statuses/{sha}","languages_url":"https://api.github.com/repos/davide125/chef-cookbooks/languages","stargazers_url":"https://api.github.com/repos/davide125/chef-cookbooks/stargazers","contributors_url":"https://api.github.com/repos/davide125/chef-cookbooks/contributors","subscribers_url":"https://api.github.com/repos/davide125/chef-cookbooks/subscribers","subscription_url":"https://api.github.com/repos/davide125/chef-cookbooks/subscription","commits_url":"https://api.github.com/repos/davide125/chef-cookbooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/davide125/chef-cookbooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/davide125/chef-cookbooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/davide125/chef-cookbooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/davide125/chef-cookbooks/contents/{+path}","compare_url":"https://api.github.com/repos/davide125/chef-cookbooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davide125/chef-cookbooks/merges","archive_url":"https://api.github.com/repos/davide125/chef-cookbooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davide125/chef-cookbooks/downloads","issues_url":"https://api.github.com/repos/davide125/chef-cookbooks/issues{/number}","pulls_url":"https://api.github.com/repos/davide125/chef-cookbooks/pulls{/number}","milestones_url":"https://api.github.com/repos/davide125/chef-cookbooks/milestones{/number}","notifications_url":"https://api.github.com/repos/davide125/chef-cookbooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davide125/chef-cookbooks/labels{/name}","releases_url":"https://api.github.com/repos/davide125/chef-cookbooks/releases{/id}","deployments_url":"https://api.github.com/repos/davide125/chef-cookbooks/deployments","created_at":"2016-04-16T00:23:38Z","updated_at":"2016-04-16T00:23:39Z","pushed_at":"2016-04-27T17:16:39Z","git_url":"git://github.com/davide125/chef-cookbooks.git","ssh_url":"git@github.com:davide125/chef-cookbooks.git","clone_url":"https://github.com/davide125/chef-cookbooks.git","svn_url":"https://github.com/davide125/chef-cookbooks","homepage":null,"size":100,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"facebook:master","ref":"master","sha":"4ae42a0ea307dcb95860204102768c0734c0c717","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":48260686,"name":"chef-cookbooks","full_name":"facebook/chef-cookbooks","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/chef-cookbooks","description":"Open source chef cookbooks.","fork":false,"url":"https://api.github.com/repos/facebook/chef-cookbooks","forks_url":"https://api.github.com/repos/facebook/chef-cookbooks/forks","keys_url":"https://api.github.com/repos/facebook/chef-cookbooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/chef-cookbooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/chef-cookbooks/teams","hooks_url":"https://api.github.com/repos/facebook/chef-cookbooks/hooks","issue_events_url":"https://api.github.com/repos/facebook/chef-cookbooks/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/chef-cookbooks/events","assignees_url":"https://api.github.com/repos/facebook/chef-cookbooks/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/chef-cookbooks/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/chef-cookbooks/tags","blobs_url":"https://api.github.com/repos/facebook/chef-cookbooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/chef-cookbooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/chef-cookbooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/chef-cookbooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/chef-cookbooks/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/chef-cookbooks/languages","stargazers_url":"https://api.github.com/repos/facebook/chef-cookbooks/stargazers","contributors_url":"https://api.github.com/repos/facebook/chef-cookbooks/contributors","subscribers_url":"https://api.github.com/repos/facebook/chef-cookbooks/subscribers","subscription_url":"https://api.github.com/repos/facebook/chef-cookbooks/subscription","commits_url":"https://api.github.com/repos/facebook/chef-cookbooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/chef-cookbooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/chef-cookbooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/chef-cookbooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/chef-cookbooks/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/chef-cookbooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/chef-cookbooks/merges","archive_url":"https://api.github.com/repos/facebook/chef-cookbooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/chef-cookbooks/downloads","issues_url":"https://api.github.com/repos/facebook/chef-cookbooks/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/chef-cookbooks/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/chef-cookbooks/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/chef-cookbooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/chef-cookbooks/labels{/name}","releases_url":"https://api.github.com/repos/facebook/chef-cookbooks/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/chef-cookbooks/deployments","created_at":"2015-12-18T23:14:27Z","updated_at":"2016-04-27T15:44:53Z","pushed_at":"2016-04-27T17:16:39Z","git_url":"git://github.com/facebook/chef-cookbooks.git","ssh_url":"git@github.com:facebook/chef-cookbooks.git","clone_url":"https://github.com/facebook/chef-cookbooks.git","svn_url":"https://github.com/facebook/chef-cookbooks","homepage":null,"size":108,"stargazers_count":132,"watchers_count":132,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":1,"forks":16,"open_issues":1,"watchers":132,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1"},"html":{"href":"https://github.com/facebook/chef-cookbooks/pull/1"},"issue":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/issues/1"},"comments":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/chef-cookbooks/statuses/8d300dcde3f4bb73ce8f9bb6e16a42289e51f6d8"}}}}