{"action":"created","comment":{"url":"https://api.github.com/repos/square/p2/pulls/comments/82251123","pull_request_review_id":3172038,"id":82251123,"diff_hunk":"@@ -0,0 +1,143 @@\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"os\"\n+\t\"strings\"\n+\n+\t\"github.com/square/p2/pkg/kp\"\n+\t\"github.com/square/p2/pkg/kp/flags\"\n+\t\"github.com/square/p2/pkg/labels\"\n+\t\"github.com/square/p2/pkg/util\"\n+\t\"gopkg.in/alecthomas/kingpin.v2\"\n+\tklabels \"k8s.io/kubernetes/pkg/labels\"\n+)\n+\n+var (\n+\tcmdApply               = kingpin.Command(CmdApply, \"Apply label changes to all objects matching a selector\")\n+\tapplyLabelType         = cmdApply.Flag(\"labelType\", \"The type of label to adjust. Sometimes called the \\\"label tree\\\"\").Short('t').Required().String()\n+\tapplySubjectSelector   = cmdApply.Flag(\"selector\", \"The selector on which to modify labels.\").Short('s').Required().String()\n+\tapplyAddititiveLabels  = cmdApply.Flag(\"add\", \"The label set to apply to the subject.\").Short('a').String()\n+\tapplyDestructiveLabels = cmdApply.Flag(\"delete\", \"The label set to remove to the subject. It is not an error to include extra labels here.\").Short('d').String()\n+\n+\tcmdShow       = kingpin.Command(CmdShow, \"Show labels that apply to a particular entity (type, ID)\")\n+\tshowLabelType = cmdShow.Flag(\"labelType\", \"The type of label to adjust. Sometimes called the \\\"label tree\\\"\").Short('t').Required().String()\n+\tshowID        = cmdShow.Flag(\"id\", \"The ID of the entity to show labels for.\").Short('i').Required().String()\n+)\n+\n+const (\n+\tCmdApply = \"apply\"\n+\tCmdShow  = \"show\"\n+)\n+\n+func main() {\n+\tcmd, opts := flags.ParseWithConsulOptions()\n+\tclient := kp.NewConsulClient(opts)\n+\tapplicator := labels.NewConsulApplicator(client, 3)\n+\n+\tswitch cmd {\n+\tcase CmdShow:\n+\t\tlabelType, err := labels.AsType(*showLabelType)\n+\t\tif err != nil {\n+\t\t\tfmt.Fprintf(os.Stderr, \"Error while parsing label type. Check the commandline. \\n%v\\n\", err)","path":"bin/p2-label/main.go","position":58,"original_position":42,"commit_id":"f0076d55a934812a5d30adda688c158ab1c61290","original_commit_id":"9c116d7544e5bf570282abbbd2cca47ede89e252","user":{"login":"rudle","id":41385,"avatar_url":"https://avatars.githubusercontent.com/u/41385?v=3","gravatar_id":"","url":"https://api.github.com/users/rudle","html_url":"https://github.com/rudle","followers_url":"https://api.github.com/users/rudle/followers","following_url":"https://api.github.com/users/rudle/following{/other_user}","gists_url":"https://api.github.com/users/rudle/gists{/gist_id}","starred_url":"https://api.github.com/users/rudle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudle/subscriptions","organizations_url":"https://api.github.com/users/rudle/orgs","repos_url":"https://api.github.com/users/rudle/repos","events_url":"https://api.github.com/users/rudle/events{/privacy}","received_events_url":"https://api.github.com/users/rudle/received_events","type":"User","site_admin":false},"body":"oops, need to address this throughout","created_at":"2016-10-06T18:18:33Z","updated_at":"2016-10-06T18:34:21Z","html_url":"https://github.com/square/p2/pull/667#discussion_r82251123","pull_request_url":"https://api.github.com/repos/square/p2/pulls/667","_links":{"self":{"href":"https://api.github.com/repos/square/p2/pulls/comments/82251123"},"html":{"href":"https://github.com/square/p2/pull/667#discussion_r82251123"},"pull_request":{"href":"https://api.github.com/repos/square/p2/pulls/667"}}},"pull_request":{"url":"https://api.github.com/repos/square/p2/pulls/667","id":88151293,"html_url":"https://github.com/square/p2/pull/667","diff_url":"https://github.com/square/p2/pull/667.diff","patch_url":"https://github.com/square/p2/pull/667.patch","issue_url":"https://api.github.com/repos/square/p2/issues/667","number":667,"state":"open","locked":false,"title":"Basic functionality for p2-label","user":{"login":"rudle","id":41385,"avatar_url":"https://avatars.githubusercontent.com/u/41385?v=3","gravatar_id":"","url":"https://api.github.com/users/rudle","html_url":"https://github.com/rudle","followers_url":"https://api.github.com/users/rudle/followers","following_url":"https://api.github.com/users/rudle/following{/other_user}","gists_url":"https://api.github.com/users/rudle/gists{/gist_id}","starred_url":"https://api.github.com/users/rudle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudle/subscriptions","organizations_url":"https://api.github.com/users/rudle/orgs","repos_url":"https://api.github.com/users/rudle/repos","events_url":"https://api.github.com/users/rudle/events{/privacy}","received_events_url":"https://api.github.com/users/rudle/received_events","type":"User","site_admin":false},"body":"This doesn't do \"show $ID\" as a separate command yet, but it can be implemented by a partial label query.\r\n\r\nHere's an example session:\r\n\r\n```\r\n➜  p2-label git:(p2-label) ./p2-label $(p2-headers) --selector \"sq/hostname in (aam12.sjc1.square,aam13.sjc1.square)\" --add \"sq/test1=one\" --labelType node\r\nThe current labels are: sq/datacenter=sjc1,sq/hardware=metal,sq/hostname=aam12.sjc1.square,sq/zone=admin\r\nlabels to be added: sq/test1=one\r\nContinue?\r\nType \"y\" to confirm [n]: y\r\nThe current labels are: sq/datacenter=sjc1,sq/hardware=metal,sq/hostname=aam13.sjc1.square,sq/test1=two,sq/zone=admin\r\nlabels to be added: sq/test1=one\r\nContinue?\r\nType \"y\" to confirm [n]: y\r\n➜  p2-label git:(p2-label) p2-select \"sq/test1=one\"\r\naam12.sjc1.square\r\naam13.sjc1.square\r\n➜  p2-label git:(p2-label) ./p2-label $(p2-headers) show -t node -i aam13.sjc1.square\r\nThe current labels for aam13.sjc1.square are: sq/datacenter=sjc1,sq/hardware=metal,sq/hostname=aam13.sjc1.square,sq/test1=one,sq/testone=yeah,sq/zone=admin\r\n```","created_at":"2016-10-05T20:31:27Z","updated_at":"2016-10-06T18:40:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fce3a4d0c83f2d1197e0a422ec3268d335d73c3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/square/p2/pulls/667/commits","review_comments_url":"https://api.github.com/repos/square/p2/pulls/667/comments","review_comment_url":"https://api.github.com/repos/square/p2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/square/p2/issues/667/comments","statuses_url":"https://api.github.com/repos/square/p2/statuses/f0076d55a934812a5d30adda688c158ab1c61290","head":{"label":"rudle:p2-label","ref":"p2-label","sha":"f0076d55a934812a5d30adda688c158ab1c61290","user":{"login":"rudle","id":41385,"avatar_url":"https://avatars.githubusercontent.com/u/41385?v=3","gravatar_id":"","url":"https://api.github.com/users/rudle","html_url":"https://github.com/rudle","followers_url":"https://api.github.com/users/rudle/followers","following_url":"https://api.github.com/users/rudle/following{/other_user}","gists_url":"https://api.github.com/users/rudle/gists{/gist_id}","starred_url":"https://api.github.com/users/rudle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudle/subscriptions","organizations_url":"https://api.github.com/users/rudle/orgs","repos_url":"https://api.github.com/users/rudle/repos","events_url":"https://api.github.com/users/rudle/events{/privacy}","received_events_url":"https://api.github.com/users/rudle/received_events","type":"User","site_admin":false},"repo":{"id":43720299,"name":"p2","full_name":"rudle/p2","owner":{"login":"rudle","id":41385,"avatar_url":"https://avatars.githubusercontent.com/u/41385?v=3","gravatar_id":"","url":"https://api.github.com/users/rudle","html_url":"https://github.com/rudle","followers_url":"https://api.github.com/users/rudle/followers","following_url":"https://api.github.com/users/rudle/following{/other_user}","gists_url":"https://api.github.com/users/rudle/gists{/gist_id}","starred_url":"https://api.github.com/users/rudle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudle/subscriptions","organizations_url":"https://api.github.com/users/rudle/orgs","repos_url":"https://api.github.com/users/rudle/repos","events_url":"https://api.github.com/users/rudle/events{/privacy}","received_events_url":"https://api.github.com/users/rudle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rudle/p2","description":"Platypus Platform: Tools for Scalable Deployment","fork":true,"url":"https://api.github.com/repos/rudle/p2","forks_url":"https://api.github.com/repos/rudle/p2/forks","keys_url":"https://api.github.com/repos/rudle/p2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rudle/p2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rudle/p2/teams","hooks_url":"https://api.github.com/repos/rudle/p2/hooks","issue_events_url":"https://api.github.com/repos/rudle/p2/issues/events{/number}","events_url":"https://api.github.com/repos/rudle/p2/events","assignees_url":"https://api.github.com/repos/rudle/p2/assignees{/user}","branches_url":"https://api.github.com/repos/rudle/p2/branches{/branch}","tags_url":"https://api.github.com/repos/rudle/p2/tags","blobs_url":"https://api.github.com/repos/rudle/p2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rudle/p2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rudle/p2/git/refs{/sha}","trees_url":"https://api.github.com/repos/rudle/p2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rudle/p2/statuses/{sha}","languages_url":"https://api.github.com/repos/rudle/p2/languages","stargazers_url":"https://api.github.com/repos/rudle/p2/stargazers","contributors_url":"https://api.github.com/repos/rudle/p2/contributors","subscribers_url":"https://api.github.com/repos/rudle/p2/subscribers","subscription_url":"https://api.github.com/repos/rudle/p2/subscription","commits_url":"https://api.github.com/repos/rudle/p2/commits{/sha}","git_commits_url":"https://api.github.com/repos/rudle/p2/git/commits{/sha}","comments_url":"https://api.github.com/repos/rudle/p2/comments{/number}","issue_comment_url":"https://api.github.com/repos/rudle/p2/issues/comments{/number}","contents_url":"https://api.github.com/repos/rudle/p2/contents/{+path}","compare_url":"https://api.github.com/repos/rudle/p2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rudle/p2/merges","archive_url":"https://api.github.com/repos/rudle/p2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rudle/p2/downloads","issues_url":"https://api.github.com/repos/rudle/p2/issues{/number}","pulls_url":"https://api.github.com/repos/rudle/p2/pulls{/number}","milestones_url":"https://api.github.com/repos/rudle/p2/milestones{/number}","notifications_url":"https://api.github.com/repos/rudle/p2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rudle/p2/labels{/name}","releases_url":"https://api.github.com/repos/rudle/p2/releases{/id}","deployments_url":"https://api.github.com/repos/rudle/p2/deployments","created_at":"2015-10-05T23:46:14Z","updated_at":"2016-01-21T18:20:01Z","pushed_at":"2016-10-06T18:34:21Z","git_url":"git://github.com/rudle/p2.git","ssh_url":"git@github.com:rudle/p2.git","clone_url":"https://github.com/rudle/p2.git","svn_url":"https://github.com/rudle/p2","homepage":"","size":49478,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"square:master","ref":"master","sha":"1101ada9fd3d98472574e43236960ec5c1285823","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":25320424,"name":"p2","full_name":"square/p2","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/p2","description":"Platypus Platform: Tools for Scalable Deployment","fork":false,"url":"https://api.github.com/repos/square/p2","forks_url":"https://api.github.com/repos/square/p2/forks","keys_url":"https://api.github.com/repos/square/p2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/p2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/p2/teams","hooks_url":"https://api.github.com/repos/square/p2/hooks","issue_events_url":"https://api.github.com/repos/square/p2/issues/events{/number}","events_url":"https://api.github.com/repos/square/p2/events","assignees_url":"https://api.github.com/repos/square/p2/assignees{/user}","branches_url":"https://api.github.com/repos/square/p2/branches{/branch}","tags_url":"https://api.github.com/repos/square/p2/tags","blobs_url":"https://api.github.com/repos/square/p2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/p2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/p2/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/p2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/p2/statuses/{sha}","languages_url":"https://api.github.com/repos/square/p2/languages","stargazers_url":"https://api.github.com/repos/square/p2/stargazers","contributors_url":"https://api.github.com/repos/square/p2/contributors","subscribers_url":"https://api.github.com/repos/square/p2/subscribers","subscription_url":"https://api.github.com/repos/square/p2/subscription","commits_url":"https://api.github.com/repos/square/p2/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/p2/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/p2/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/p2/issues/comments{/number}","contents_url":"https://api.github.com/repos/square/p2/contents/{+path}","compare_url":"https://api.github.com/repos/square/p2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/p2/merges","archive_url":"https://api.github.com/repos/square/p2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/p2/downloads","issues_url":"https://api.github.com/repos/square/p2/issues{/number}","pulls_url":"https://api.github.com/repos/square/p2/pulls{/number}","milestones_url":"https://api.github.com/repos/square/p2/milestones{/number}","notifications_url":"https://api.github.com/repos/square/p2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/p2/labels{/name}","releases_url":"https://api.github.com/repos/square/p2/releases{/id}","deployments_url":"https://api.github.com/repos/square/p2/deployments","created_at":"2014-10-16T20:31:12Z","updated_at":"2016-09-29T02:50:39Z","pushed_at":"2016-10-06T18:34:21Z","git_url":"git://github.com/square/p2.git","ssh_url":"git@github.com:square/p2.git","clone_url":"https://github.com/square/p2.git","svn_url":"https://github.com/square/p2","homepage":"","size":41617,"stargazers_count":125,"watchers_count":125,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":6,"forks":22,"open_issues":6,"watchers":125,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/square/p2/pulls/667"},"html":{"href":"https://github.com/square/p2/pull/667"},"issue":{"href":"https://api.github.com/repos/square/p2/issues/667"},"comments":{"href":"https://api.github.com/repos/square/p2/issues/667/comments"},"review_comments":{"href":"https://api.github.com/repos/square/p2/pulls/667/comments"},"review_comment":{"href":"https://api.github.com/repos/square/p2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/square/p2/pulls/667/commits"},"statuses":{"href":"https://api.github.com/repos/square/p2/statuses/f0076d55a934812a5d30adda688c158ab1c61290"}}}}
{"actor":{"display_login":"rudle"}}