{"action":"created","comment":{"url":"https://api.github.com/repos/chef/knife-opc/pulls/comments/46634937","id":46634937,"diff_hunk":"@@ -36,12 +43,39 @@ def run\n       end\n \n       org = Chef::Org.new(@org_name)\n+\n+      if config[:force_remove_from_admins]\n+        begin\n+          org.remove_user_from_group(\"admins\", username)\n+          org.remove_user_from_group(\"billing-admins\", username)\n+        rescue Net::HTTPServerException => e\n+          if e.response.code == \"404\"\n+            ui.msg \"User #{username} is not in the admins group for organization #{org_name}. Do not pass --force_remove_from_admins.\"","path":"lib/chef/knife/opc_org_user_remove.rb","position":27,"original_position":27,"commit_id":"199ef7bb4a9ca6088333bcad68765ef7736a41b0","original_commit_id":"199ef7bb4a9ca6088333bcad68765ef7736a41b0","user":{"login":"tylercloke","id":1899715,"avatar_url":"https://avatars.githubusercontent.com/u/1899715?v=3","gravatar_id":"","url":"https://api.github.com/users/tylercloke","html_url":"https://github.com/tylercloke","followers_url":"https://api.github.com/users/tylercloke/followers","following_url":"https://api.github.com/users/tylercloke/following{/other_user}","gists_url":"https://api.github.com/users/tylercloke/gists{/gist_id}","starred_url":"https://api.github.com/users/tylercloke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylercloke/subscriptions","organizations_url":"https://api.github.com/users/tylercloke/orgs","repos_url":"https://api.github.com/users/tylercloke/repos","events_url":"https://api.github.com/users/tylercloke/events{/privacy}","received_events_url":"https://api.github.com/users/tylercloke/received_events","type":"User","site_admin":false},"body":"Both good points! I'll make it warn and pull those into separate rescue blocks.","created_at":"2015-12-04T00:39:14Z","updated_at":"2015-12-04T00:39:14Z","html_url":"https://github.com/chef/knife-opc/pull/35#discussion_r46634937","pull_request_url":"https://api.github.com/repos/chef/knife-opc/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/comments/46634937"},"html":{"href":"https://github.com/chef/knife-opc/pull/35#discussion_r46634937"},"pull_request":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/chef/knife-opc/pulls/35","id":52614676,"html_url":"https://github.com/chef/knife-opc/pull/35","diff_url":"https://github.com/chef/knife-opc/pull/35.diff","patch_url":"https://github.com/chef/knife-opc/pull/35.patch","issue_url":"https://api.github.com/repos/chef/knife-opc/issues/35","number":35,"state":"open","locked":false,"title":"Add --force_remove_from_admins to org user remove.","user":{"login":"tylercloke","id":1899715,"avatar_url":"https://avatars.githubusercontent.com/u/1899715?v=3","gravatar_id":"","url":"https://api.github.com/users/tylercloke","html_url":"https://github.com/tylercloke","followers_url":"https://api.github.com/users/tylercloke/followers","following_url":"https://api.github.com/users/tylercloke/following{/other_user}","gists_url":"https://api.github.com/users/tylercloke/gists{/gist_id}","starred_url":"https://api.github.com/users/tylercloke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylercloke/subscriptions","organizations_url":"https://api.github.com/users/tylercloke/orgs","repos_url":"https://api.github.com/users/tylercloke/repos","events_url":"https://api.github.com/users/tylercloke/events{/privacy}","received_events_url":"https://api.github.com/users/tylercloke/received_events","type":"User","site_admin":false},"body":"This removes the user from the admins and server-admins groups. This is to get around issues related to not being able to remove users from organization associations.","created_at":"2015-12-04T00:34:28Z","updated_at":"2015-12-04T00:39:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"411e8905179528d097c837d08e90068db21f0fb1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chef/knife-opc/pulls/35/commits","review_comments_url":"https://api.github.com/repos/chef/knife-opc/pulls/35/comments","review_comment_url":"https://api.github.com/repos/chef/knife-opc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chef/knife-opc/issues/35/comments","statuses_url":"https://api.github.com/repos/chef/knife-opc/statuses/199ef7bb4a9ca6088333bcad68765ef7736a41b0","head":{"label":"chef:tc/force_remove_from_admins","ref":"tc/force_remove_from_admins","sha":"199ef7bb4a9ca6088333bcad68765ef7736a41b0","user":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"repo":{"id":4948393,"name":"knife-opc","full_name":"chef/knife-opc","owner":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chef/knife-opc","description":"Knife plugin for managing Chef Server Organizations","fork":false,"url":"https://api.github.com/repos/chef/knife-opc","forks_url":"https://api.github.com/repos/chef/knife-opc/forks","keys_url":"https://api.github.com/repos/chef/knife-opc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chef/knife-opc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chef/knife-opc/teams","hooks_url":"https://api.github.com/repos/chef/knife-opc/hooks","issue_events_url":"https://api.github.com/repos/chef/knife-opc/issues/events{/number}","events_url":"https://api.github.com/repos/chef/knife-opc/events","assignees_url":"https://api.github.com/repos/chef/knife-opc/assignees{/user}","branches_url":"https://api.github.com/repos/chef/knife-opc/branches{/branch}","tags_url":"https://api.github.com/repos/chef/knife-opc/tags","blobs_url":"https://api.github.com/repos/chef/knife-opc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chef/knife-opc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chef/knife-opc/git/refs{/sha}","trees_url":"https://api.github.com/repos/chef/knife-opc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chef/knife-opc/statuses/{sha}","languages_url":"https://api.github.com/repos/chef/knife-opc/languages","stargazers_url":"https://api.github.com/repos/chef/knife-opc/stargazers","contributors_url":"https://api.github.com/repos/chef/knife-opc/contributors","subscribers_url":"https://api.github.com/repos/chef/knife-opc/subscribers","subscription_url":"https://api.github.com/repos/chef/knife-opc/subscription","commits_url":"https://api.github.com/repos/chef/knife-opc/commits{/sha}","git_commits_url":"https://api.github.com/repos/chef/knife-opc/git/commits{/sha}","comments_url":"https://api.github.com/repos/chef/knife-opc/comments{/number}","issue_comment_url":"https://api.github.com/repos/chef/knife-opc/issues/comments{/number}","contents_url":"https://api.github.com/repos/chef/knife-opc/contents/{+path}","compare_url":"https://api.github.com/repos/chef/knife-opc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chef/knife-opc/merges","archive_url":"https://api.github.com/repos/chef/knife-opc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chef/knife-opc/downloads","issues_url":"https://api.github.com/repos/chef/knife-opc/issues{/number}","pulls_url":"https://api.github.com/repos/chef/knife-opc/pulls{/number}","milestones_url":"https://api.github.com/repos/chef/knife-opc/milestones{/number}","notifications_url":"https://api.github.com/repos/chef/knife-opc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chef/knife-opc/labels{/name}","releases_url":"https://api.github.com/repos/chef/knife-opc/releases{/id}","created_at":"2012-07-08T17:51:32Z","updated_at":"2015-04-08T12:31:57Z","pushed_at":"2015-12-04T00:34:28Z","git_url":"git://github.com/chef/knife-opc.git","ssh_url":"git@github.com:chef/knife-opc.git","clone_url":"https://github.com/chef/knife-opc.git","svn_url":"https://github.com/chef/knife-opc","homepage":"","size":83,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":2,"forks":17,"open_issues":2,"watchers":14,"default_branch":"master"}},"base":{"label":"chef:master","ref":"master","sha":"528be9237b3637510107b1db51897d74821d87db","user":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"repo":{"id":4948393,"name":"knife-opc","full_name":"chef/knife-opc","owner":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chef/knife-opc","description":"Knife plugin for managing Chef Server Organizations","fork":false,"url":"https://api.github.com/repos/chef/knife-opc","forks_url":"https://api.github.com/repos/chef/knife-opc/forks","keys_url":"https://api.github.com/repos/chef/knife-opc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chef/knife-opc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chef/knife-opc/teams","hooks_url":"https://api.github.com/repos/chef/knife-opc/hooks","issue_events_url":"https://api.github.com/repos/chef/knife-opc/issues/events{/number}","events_url":"https://api.github.com/repos/chef/knife-opc/events","assignees_url":"https://api.github.com/repos/chef/knife-opc/assignees{/user}","branches_url":"https://api.github.com/repos/chef/knife-opc/branches{/branch}","tags_url":"https://api.github.com/repos/chef/knife-opc/tags","blobs_url":"https://api.github.com/repos/chef/knife-opc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chef/knife-opc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chef/knife-opc/git/refs{/sha}","trees_url":"https://api.github.com/repos/chef/knife-opc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chef/knife-opc/statuses/{sha}","languages_url":"https://api.github.com/repos/chef/knife-opc/languages","stargazers_url":"https://api.github.com/repos/chef/knife-opc/stargazers","contributors_url":"https://api.github.com/repos/chef/knife-opc/contributors","subscribers_url":"https://api.github.com/repos/chef/knife-opc/subscribers","subscription_url":"https://api.github.com/repos/chef/knife-opc/subscription","commits_url":"https://api.github.com/repos/chef/knife-opc/commits{/sha}","git_commits_url":"https://api.github.com/repos/chef/knife-opc/git/commits{/sha}","comments_url":"https://api.github.com/repos/chef/knife-opc/comments{/number}","issue_comment_url":"https://api.github.com/repos/chef/knife-opc/issues/comments{/number}","contents_url":"https://api.github.com/repos/chef/knife-opc/contents/{+path}","compare_url":"https://api.github.com/repos/chef/knife-opc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chef/knife-opc/merges","archive_url":"https://api.github.com/repos/chef/knife-opc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chef/knife-opc/downloads","issues_url":"https://api.github.com/repos/chef/knife-opc/issues{/number}","pulls_url":"https://api.github.com/repos/chef/knife-opc/pulls{/number}","milestones_url":"https://api.github.com/repos/chef/knife-opc/milestones{/number}","notifications_url":"https://api.github.com/repos/chef/knife-opc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chef/knife-opc/labels{/name}","releases_url":"https://api.github.com/repos/chef/knife-opc/releases{/id}","created_at":"2012-07-08T17:51:32Z","updated_at":"2015-04-08T12:31:57Z","pushed_at":"2015-12-04T00:34:28Z","git_url":"git://github.com/chef/knife-opc.git","ssh_url":"git@github.com:chef/knife-opc.git","clone_url":"https://github.com/chef/knife-opc.git","svn_url":"https://github.com/chef/knife-opc","homepage":"","size":83,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":2,"forks":17,"open_issues":2,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/35"},"html":{"href":"https://github.com/chef/knife-opc/pull/35"},"issue":{"href":"https://api.github.com/repos/chef/knife-opc/issues/35"},"comments":{"href":"https://api.github.com/repos/chef/knife-opc/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chef/knife-opc/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/chef/knife-opc/statuses/199ef7bb4a9ca6088333bcad68765ef7736a41b0"}}}}