GitHub PullRequestReviewCommentEvent at 2014-07-08 00:34:58
Repository: ops
Actor: WrathOfChris
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/WrathOfChris/ops/pulls/comments/14631391","id":14631391,"diff_hunk":"@@ -609,41 +609,68 @@ def find_sg_rule_cidr(cidr , p_from, p_to, p_prot, rules):\n         print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n \n   # SSH:APP rule\n-  rule = find_sg_rule_cidr('0.0.0.0/0', 22, 22, 'tcp', sg.rules)\n-  if rule == None:\n-    print \"Creating SG rule for SSH -> SG\"\n-    if awsec2.authorize_security_group(group_id = sg.id,\n-          cidr_ip = '0.0.0.0/0',\n-          ip_protocol = 'tcp',\n-          from_port = 22,\n-          to_port = 22\n-        ) != True:\n-      print \"Failed authorizing SSH->SG\"\n-      sys.exit(1)\n-    sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n-    sg = find_sg(app['group'], sgs)\n-    rule = find_sg_rule_cidr('0.0.0.0/0', 22, 22, 'tcp', sg.rules)\n-  if verbose:\n-    print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n-\n-  # icmp\n-  if 'privnet' in conf['aws'].keys():\n-    rule = find_sg_rule_cidr(conf['aws']['privnet'], -1, -1, 'icmp', sg.rules)\n-    if rule == None:\n-      print \"Creating SG rule for ICMP -> SG\"\n-      if awsec2.authorize_security_group(group_id = sg.id,\n-            cidr_ip = conf['aws']['privnet'],\n-            ip_protocol = 'icmp',\n-            from_port = -1,\n-            to_port = -1 \n-          ) != True:\n-        print \"Failed authorizing ICMP->SG\"\n-        sys.exit(1)\n-      sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n-      sg = find_sg(app['group'], sgs)\n-      rule = find_sg_rule_cidr(conf['aws']['privnet'], -1, -1, 'icmp', sg.rules)\n-  if verbose:\n-    print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n+  if \"public_rules\" not in conf['vpc']:\n+      rule = find_sg_rule_cidr('0.0.0.0/0', 22, 22, 'tcp', sg.rules)\n+      if rule == None:\n+        print \"Creating SG rule for SSH -> SG\"\n+        if awsec2.authorize_security_group(group_id = sg.id,\n+              cidr_ip = '0.0.0.0/0',\n+              ip_protocol = 'tcp',\n+              from_port = 22,\n+              to_port = 22\n+            ) != True:\n+          print \"Failed authorizing SSH->SG\"\n+          sys.exit(1)\n+        sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n+        sg = find_sg(app['group'], sgs)\n+        rule = find_sg_rule_cidr('0.0.0.0/0', 22, 22, 'tcp', sg.rules)\n+      if verbose:\n+        print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n+  else:\n+      for public_rule in conf['vpc']['public_rules']:\n+          rule = find_sg_rule_cidr(public_rule['cidr_ip'], public_rule['from_port'], public_rule['to_port'], public_rule['ip_protocol'], sg.rules)\n+          if rule == None:\n+              print \"Creating SG rule for {}\".format(public_rule)\n+              if awsec2.authorize_security_group(group_id = sg.id, **public_rule) != True:\n+                  print \"Failed authorizing {}\".format(public_rule)\n+                  sys.exit(1)\n+              if verbose:\n+                  sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n+                  sg = find_sg(app['group'], sgs)\n+                  rule = find_sg_rule_cidr(public_rule['cidr_ip'], public_rule['from_port'], public_rule['to_port'], public_rule['ip_protocol'], sg.rules)\n+                  print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n+  if \"privnet_rules\" not in conf['vpc']:\n+      # icmp\n+      if 'privnet' in conf['aws'].keys():\n+        rule = find_sg_rule_cidr(conf['aws']['privnet'], -1, -1, 'icmp', sg.rules)\n+        if rule == None:\n+          print \"Creating SG rule for ICMP -> SG\"\n+          if awsec2.authorize_security_group(group_id = sg.id,\n+                cidr_ip = conf['aws']['privnet'],\n+                ip_protocol = 'icmp',\n+                from_port = -1,\n+                to_port = -1 \n+              ) != True:\n+            print \"Failed authorizing ICMP->SG\"\n+            sys.exit(1)\n+          sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n+          sg = find_sg(app['group'], sgs)\n+          rule = find_sg_rule_cidr(conf['aws']['privnet'], -1, -1, 'icmp', sg.rules)\n+      if verbose:\n+        print \"SGRULE %s src %s %s %s:%s\" % (sg.name, rule.grants, rule.ip_protocol, rule.from_port, rule.to_port)\n+  else:\n+      for private_rule in conf['vpc']['privnet_rules']:\n+          rule = find_sg_rule_cidr(private_rule['cidr_ip'], private_rule['from_port'], private_rule['to_port'], private_rule['ip_protocol'], sg.rules)\n+          if rule == None:\n+              print \"Creating SG rule for {}\".format(private_rule)\n+              if awsec2.authorize_security_group(group_id = sg.id, **private_rule) != True:\n+                  print \"Failed authorizing {}\".format(private_rule)\n+                  sys.exit(1)\n+              if verbose:\n+                  sgs = awsec2.get_all_security_groups(filters=vpcfilter)\n+                  sg = find_sg(app['group'], sgs)\n+                  rule = find_sg_rule_cidr('0.0.0.0/0', 22, 22, 'tcp', sg.rules)","path":"cloudcaster/cloudcaster.py","position":99,"original_position":99,"commit_id":"12168d88dac09922ebc8cca886dc2e2ec643e7df","original_commit_id":"12168d88dac09922ebc8cca886dc2e2ec643e7df","user":{"login":"WrathOfChris","id":2590796,"avatar_url":"https://avatars.githubusercontent.com/u/2590796?","gravatar_id":"81d7fca6e8ac0dfe08c8a758dca113b3","url":"https://api.github.com/users/WrathOfChris","html_url":"https://github.com/WrathOfChris","followers_url":"https://api.github.com/users/WrathOfChris/followers","following_url":"https://api.github.com/users/WrathOfChris/following{/other_user}","gists_url":"https://api.github.com/users/WrathOfChris/gists{/gist_id}","starred_url":"https://api.github.com/users/WrathOfChris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WrathOfChris/subscriptions","organizations_url":"https://api.github.com/users/WrathOfChris/orgs","repos_url":"https://api.github.com/users/WrathOfChris/repos","events_url":"https://api.github.com/users/WrathOfChris/events{/privacy}","received_events_url":"https://api.github.com/users/WrathOfChris/received_events","type":"User","site_admin":false},"body":"Actually, should be all the fields from private_rule","created_at":"2014-07-08T00:34:58Z","updated_at":"2014-07-08T00:34:58Z","html_url":"https://github.com/WrathOfChris/ops/pull/25#discussion_r14631391","pull_request_url":"https://api.github.com/repos/WrathOfChris/ops/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/comments/14631391"},"html":{"href":"https://github.com/WrathOfChris/ops/pull/25#discussion_r14631391"},"pull_request":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/WrathOfChris/ops/pulls/25","id":18077180,"html_url":"https://github.com/WrathOfChris/ops/pull/25","diff_url":"https://github.com/WrathOfChris/ops/pull/25.diff","patch_url":"https://github.com/WrathOfChris/ops/pull/25.patch","issue_url":"https://api.github.com/repos/WrathOfChris/ops/issues/25","number":25,"state":"open","title":"Attempts to declare default rules from VPC","user":{"login":"vjanelle","id":733641,"avatar_url":"https://avatars.githubusercontent.com/u/733641?","gravatar_id":null,"url":"https://api.github.com/users/vjanelle","html_url":"https://github.com/vjanelle","followers_url":"https://api.github.com/users/vjanelle/followers","following_url":"https://api.github.com/users/vjanelle/following{/other_user}","gists_url":"https://api.github.com/users/vjanelle/gists{/gist_id}","starred_url":"https://api.github.com/users/vjanelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjanelle/subscriptions","organizations_url":"https://api.github.com/users/vjanelle/orgs","repos_url":"https://api.github.com/users/vjanelle/repos","events_url":"https://api.github.com/users/vjanelle/events{/privacy}","received_events_url":"https://api.github.com/users/vjanelle/received_events","type":"User","site_admin":false},"body":"@WrathOfChris - Should handle graceful fallback.","created_at":"2014-07-08T00:22:11Z","updated_at":"2014-07-08T00:34:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aaa1940944ad790a103a34f9e590c792c0239e7a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/WrathOfChris/ops/pulls/25/commits","review_comments_url":"https://api.github.com/repos/WrathOfChris/ops/pulls/25/comments","review_comment_url":"https://api.github.com/repos/WrathOfChris/ops/pulls/comments/{number}","comments_url":"https://api.github.com/repos/WrathOfChris/ops/issues/25/comments","statuses_url":"https://api.github.com/repos/WrathOfChris/ops/statuses/12168d88dac09922ebc8cca886dc2e2ec643e7df","head":{"label":"vjanelle:cloudcaster_default_sg_rules","ref":"cloudcaster_default_sg_rules","sha":"12168d88dac09922ebc8cca886dc2e2ec643e7df","user":{"login":"vjanelle","id":733641,"avatar_url":"https://avatars.githubusercontent.com/u/733641?","gravatar_id":null,"url":"https://api.github.com/users/vjanelle","html_url":"https://github.com/vjanelle","followers_url":"https://api.github.com/users/vjanelle/followers","following_url":"https://api.github.com/users/vjanelle/following{/other_user}","gists_url":"https://api.github.com/users/vjanelle/gists{/gist_id}","starred_url":"https://api.github.com/users/vjanelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjanelle/subscriptions","organizations_url":"https://api.github.com/users/vjanelle/orgs","repos_url":"https://api.github.com/users/vjanelle/repos","events_url":"https://api.github.com/users/vjanelle/events{/privacy}","received_events_url":"https://api.github.com/users/vjanelle/received_events","type":"User","site_admin":false},"repo":{"id":17989648,"name":"ops","full_name":"vjanelle/ops","owner":{"login":"vjanelle","id":733641,"avatar_url":"https://avatars.githubusercontent.com/u/733641?","gravatar_id":null,"url":"https://api.github.com/users/vjanelle","html_url":"https://github.com/vjanelle","followers_url":"https://api.github.com/users/vjanelle/followers","following_url":"https://api.github.com/users/vjanelle/following{/other_user}","gists_url":"https://api.github.com/users/vjanelle/gists{/gist_id}","starred_url":"https://api.github.com/users/vjanelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjanelle/subscriptions","organizations_url":"https://api.github.com/users/vjanelle/orgs","repos_url":"https://api.github.com/users/vjanelle/repos","events_url":"https://api.github.com/users/vjanelle/events{/privacy}","received_events_url":"https://api.github.com/users/vjanelle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vjanelle/ops","description":"Building special snowflakes consistently","fork":true,"url":"https://api.github.com/repos/vjanelle/ops","forks_url":"https://api.github.com/repos/vjanelle/ops/forks","keys_url":"https://api.github.com/repos/vjanelle/ops/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vjanelle/ops/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vjanelle/ops/teams","hooks_url":"https://api.github.com/repos/vjanelle/ops/hooks","issue_events_url":"https://api.github.com/repos/vjanelle/ops/issues/events{/number}","events_url":"https://api.github.com/repos/vjanelle/ops/events","assignees_url":"https://api.github.com/repos/vjanelle/ops/assignees{/user}","branches_url":"https://api.github.com/repos/vjanelle/ops/branches{/branch}","tags_url":"https://api.github.com/repos/vjanelle/ops/tags","blobs_url":"https://api.github.com/repos/vjanelle/ops/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vjanelle/ops/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vjanelle/ops/git/refs{/sha}","trees_url":"https://api.github.com/repos/vjanelle/ops/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vjanelle/ops/statuses/{sha}","languages_url":"https://api.github.com/repos/vjanelle/ops/languages","stargazers_url":"https://api.github.com/repos/vjanelle/ops/stargazers","contributors_url":"https://api.github.com/repos/vjanelle/ops/contributors","subscribers_url":"https://api.github.com/repos/vjanelle/ops/subscribers","subscription_url":"https://api.github.com/repos/vjanelle/ops/subscription","commits_url":"https://api.github.com/repos/vjanelle/ops/commits{/sha}","git_commits_url":"https://api.github.com/repos/vjanelle/ops/git/commits{/sha}","comments_url":"https://api.github.com/repos/vjanelle/ops/comments{/number}","issue_comment_url":"https://api.github.com/repos/vjanelle/ops/issues/comments/{number}","contents_url":"https://api.github.com/repos/vjanelle/ops/contents/{+path}","compare_url":"https://api.github.com/repos/vjanelle/ops/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vjanelle/ops/merges","archive_url":"https://api.github.com/repos/vjanelle/ops/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vjanelle/ops/downloads","issues_url":"https://api.github.com/repos/vjanelle/ops/issues{/number}","pulls_url":"https://api.github.com/repos/vjanelle/ops/pulls{/number}","milestones_url":"https://api.github.com/repos/vjanelle/ops/milestones{/number}","notifications_url":"https://api.github.com/repos/vjanelle/ops/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vjanelle/ops/labels{/name}","releases_url":"https://api.github.com/repos/vjanelle/ops/releases{/id}","created_at":"2014-03-21T18:18:17Z","updated_at":"2014-06-26T16:47:01Z","pushed_at":"2014-07-08T00:21:35Z","git_url":"git://github.com/vjanelle/ops.git","ssh_url":"git@github.com:vjanelle/ops.git","clone_url":"https://github.com/vjanelle/ops.git","svn_url":"https://github.com/vjanelle/ops","homepage":null,"size":841,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WrathOfChris:master","ref":"master","sha":"917cebb2eb33eeb22f92699b4f13f25f96a26393","user":{"login":"WrathOfChris","id":2590796,"avatar_url":"https://avatars.githubusercontent.com/u/2590796?","gravatar_id":"81d7fca6e8ac0dfe08c8a758dca113b3","url":"https://api.github.com/users/WrathOfChris","html_url":"https://github.com/WrathOfChris","followers_url":"https://api.github.com/users/WrathOfChris/followers","following_url":"https://api.github.com/users/WrathOfChris/following{/other_user}","gists_url":"https://api.github.com/users/WrathOfChris/gists{/gist_id}","starred_url":"https://api.github.com/users/WrathOfChris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WrathOfChris/subscriptions","organizations_url":"https://api.github.com/users/WrathOfChris/orgs","repos_url":"https://api.github.com/users/WrathOfChris/repos","events_url":"https://api.github.com/users/WrathOfChris/events{/privacy}","received_events_url":"https://api.github.com/users/WrathOfChris/received_events","type":"User","site_admin":false},"repo":{"id":11782131,"name":"ops","full_name":"WrathOfChris/ops","owner":{"login":"WrathOfChris","id":2590796,"avatar_url":"https://avatars.githubusercontent.com/u/2590796?","gravatar_id":"81d7fca6e8ac0dfe08c8a758dca113b3","url":"https://api.github.com/users/WrathOfChris","html_url":"https://github.com/WrathOfChris","followers_url":"https://api.github.com/users/WrathOfChris/followers","following_url":"https://api.github.com/users/WrathOfChris/following{/other_user}","gists_url":"https://api.github.com/users/WrathOfChris/gists{/gist_id}","starred_url":"https://api.github.com/users/WrathOfChris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WrathOfChris/subscriptions","organizations_url":"https://api.github.com/users/WrathOfChris/orgs","repos_url":"https://api.github.com/users/WrathOfChris/repos","events_url":"https://api.github.com/users/WrathOfChris/events{/privacy}","received_events_url":"https://api.github.com/users/WrathOfChris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/WrathOfChris/ops","description":"Building special snowflakes consistently","fork":false,"url":"https://api.github.com/repos/WrathOfChris/ops","forks_url":"https://api.github.com/repos/WrathOfChris/ops/forks","keys_url":"https://api.github.com/repos/WrathOfChris/ops/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WrathOfChris/ops/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WrathOfChris/ops/teams","hooks_url":"https://api.github.com/repos/WrathOfChris/ops/hooks","issue_events_url":"https://api.github.com/repos/WrathOfChris/ops/issues/events{/number}","events_url":"https://api.github.com/repos/WrathOfChris/ops/events","assignees_url":"https://api.github.com/repos/WrathOfChris/ops/assignees{/user}","branches_url":"https://api.github.com/repos/WrathOfChris/ops/branches{/branch}","tags_url":"https://api.github.com/repos/WrathOfChris/ops/tags","blobs_url":"https://api.github.com/repos/WrathOfChris/ops/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WrathOfChris/ops/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WrathOfChris/ops/git/refs{/sha}","trees_url":"https://api.github.com/repos/WrathOfChris/ops/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WrathOfChris/ops/statuses/{sha}","languages_url":"https://api.github.com/repos/WrathOfChris/ops/languages","stargazers_url":"https://api.github.com/repos/WrathOfChris/ops/stargazers","contributors_url":"https://api.github.com/repos/WrathOfChris/ops/contributors","subscribers_url":"https://api.github.com/repos/WrathOfChris/ops/subscribers","subscription_url":"https://api.github.com/repos/WrathOfChris/ops/subscription","commits_url":"https://api.github.com/repos/WrathOfChris/ops/commits{/sha}","git_commits_url":"https://api.github.com/repos/WrathOfChris/ops/git/commits{/sha}","comments_url":"https://api.github.com/repos/WrathOfChris/ops/comments{/number}","issue_comment_url":"https://api.github.com/repos/WrathOfChris/ops/issues/comments/{number}","contents_url":"https://api.github.com/repos/WrathOfChris/ops/contents/{+path}","compare_url":"https://api.github.com/repos/WrathOfChris/ops/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WrathOfChris/ops/merges","archive_url":"https://api.github.com/repos/WrathOfChris/ops/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WrathOfChris/ops/downloads","issues_url":"https://api.github.com/repos/WrathOfChris/ops/issues{/number}","pulls_url":"https://api.github.com/repos/WrathOfChris/ops/pulls{/number}","milestones_url":"https://api.github.com/repos/WrathOfChris/ops/milestones{/number}","notifications_url":"https://api.github.com/repos/WrathOfChris/ops/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WrathOfChris/ops/labels{/name}","releases_url":"https://api.github.com/repos/WrathOfChris/ops/releases{/id}","created_at":"2013-07-31T04:09:24Z","updated_at":"2014-06-26T15:59:38Z","pushed_at":"2014-07-07T20:08:54Z","git_url":"git://github.com/WrathOfChris/ops.git","ssh_url":"git@github.com:WrathOfChris/ops.git","clone_url":"https://github.com/WrathOfChris/ops.git","svn_url":"https://github.com/WrathOfChris/ops","homepage":null,"size":1213,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/25"},"html":{"href":"https://github.com/WrathOfChris/ops/pull/25"},"issue":{"href":"https://api.github.com/repos/WrathOfChris/ops/issues/25"},"comments":{"href":"https://api.github.com/repos/WrathOfChris/ops/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/WrathOfChris/ops/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/WrathOfChris/ops/statuses/12168d88dac09922ebc8cca886dc2e2ec643e7df"}}}}