{"action":"created","comment":{"url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/comments/175953497","pull_request_review_id":105485864,"id":175953497,"diff_hunk":"@@ -287,3 +305,37 @@ func (a *apiServer) GetState(ctx context.Context, req *ec.GetStateRequest) (resp\n \t}\n \treturn resp, nil\n }\n+\n+// Deactivate deletes the current cluster's enterprise token, and puts the\n+// cluster in the \"NONE\" enterprise state. It also deletes all data in the\n+// cluster, to avoid invalid cluster states. This call only makes sense for\n+// testing\n+func (a *apiServer) Deactivate(ctx context.Context, req *ec.DeactivateRequest) (resp *ec.DeactivateResponse, retErr error) {\n+\ta.LogReq(req)\n+\tdefer func(start time.Time) { a.pachLogger.Log(req, resp, retErr, time.Since(start)) }(time.Now())\n+\n+\tpachClient := a.getPachClient().WithCtx(ctx)\n+\tif err := pachClient.DeleteAll(); err != nil {\n+\t\treturn nil, fmt.Errorf(\"could not delete all pachyderm data: %v\", err)\n+\t}\n+\n+\tif _, err := col.NewSTM(ctx, a.etcdClient, func(stm col.STM) error {\n+\t\t// blind delete\n+\t\treturn a.enterpriseToken.ReadWrite(stm).Delete(enterpriseTokenKey)\n+\t}); err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\t// Wait until watcher observes the write\n+\tif err := backoff.Retry(func() error {\n+\t\tif t := a.enterpriseExpiration.Load().(time.Time); !t.IsZero() {\n+\t\t\treturn fmt.Errorf(\"enterprise still activated\")\n+\t\t}\n+\t\treturn nil\n+\t}, backoff.RetryEvery(time.Second)); err != nil {\n+\t\treturn nil, err\n+\t}\n+\ttime.Sleep(time.Second) // give other pachd nodes time to observe the write","path":"src/server/enterprise/server/api_server.go","position":86,"original_position":86,"commit_id":"8c14df5a1efe5f37b64586814e99db9d01100291","original_commit_id":"8c14df5a1efe5f37b64586814e99db9d01100291","user":{"login":"sjezewski","id":597953,"avatar_url":"https://avatars1.githubusercontent.com/u/597953?v=4","gravatar_id":"","url":"https://api.github.com/users/sjezewski","html_url":"https://github.com/sjezewski","followers_url":"https://api.github.com/users/sjezewski/followers","following_url":"https://api.github.com/users/sjezewski/following{/other_user}","gists_url":"https://api.github.com/users/sjezewski/gists{/gist_id}","starred_url":"https://api.github.com/users/sjezewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjezewski/subscriptions","organizations_url":"https://api.github.com/users/sjezewski/orgs","repos_url":"https://api.github.com/users/sjezewski/repos","events_url":"https://api.github.com/users/sjezewski/events{/privacy}","received_events_url":"https://api.github.com/users/sjezewski/received_events","type":"User","site_admin":false},"body":"Huh. I just read the code for the enterprise state. I see its cached, which makes sense ... you wouldn't want to issue an etcd query anytime the server needs to check for access. But that really only happens in the multi-pachd pod world, right? Couldn't you grab the lock / edit the value for this server, and that would be sufficient to update this pachd's enterprise state?\r\n\r\nI'm not sure if this is something we need to change. In theory we do want to support multiple pachd pod deployments. On the other hand, this method is self described as a testing only method, and our tests currently only use a single pachd pod.","created_at":"2018-03-20T23:27:50Z","updated_at":"2018-03-20T23:27:50Z","html_url":"https://github.com/pachyderm/pachyderm/pull/2794#discussion_r175953497","pull_request_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/comments/175953497"},"html":{"href":"https://github.com/pachyderm/pachyderm/pull/2794#discussion_r175953497"},"pull_request":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794"}}},"pull_request":{"url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794","id":176097248,"html_url":"https://github.com/pachyderm/pachyderm/pull/2794","diff_url":"https://github.com/pachyderm/pachyderm/pull/2794.diff","patch_url":"https://github.com/pachyderm/pachyderm/pull/2794.patch","issue_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/2794","number":2794,"state":"open","locked":false,"title":"Add \"Deactivate\" to enterprise API, for testing","user":{"login":"msteffen","id":235674,"avatar_url":"https://avatars1.githubusercontent.com/u/235674?v=4","gravatar_id":"","url":"https://api.github.com/users/msteffen","html_url":"https://github.com/msteffen","followers_url":"https://api.github.com/users/msteffen/followers","following_url":"https://api.github.com/users/msteffen/following{/other_user}","gists_url":"https://api.github.com/users/msteffen/gists{/gist_id}","starred_url":"https://api.github.com/users/msteffen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msteffen/subscriptions","organizations_url":"https://api.github.com/users/msteffen/orgs","repos_url":"https://api.github.com/users/msteffen/repos","events_url":"https://api.github.com/users/msteffen/events{/privacy}","received_events_url":"https://api.github.com/users/msteffen/received_events","type":"User","site_admin":false},"body":"Note that `enterprise.Deactivate` also calls `DeleteAll()`, to avoid invalid cluster states (e.g. auth on but enterprise state = `NONE`)","created_at":"2018-03-20T06:11:08Z","updated_at":"2018-03-20T23:27:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"681c857012cf762d394008a959acd554f9967f40","assignee":{"login":"sjezewski","id":597953,"avatar_url":"https://avatars1.githubusercontent.com/u/597953?v=4","gravatar_id":"","url":"https://api.github.com/users/sjezewski","html_url":"https://github.com/sjezewski","followers_url":"https://api.github.com/users/sjezewski/followers","following_url":"https://api.github.com/users/sjezewski/following{/other_user}","gists_url":"https://api.github.com/users/sjezewski/gists{/gist_id}","starred_url":"https://api.github.com/users/sjezewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjezewski/subscriptions","organizations_url":"https://api.github.com/users/sjezewski/orgs","repos_url":"https://api.github.com/users/sjezewski/repos","events_url":"https://api.github.com/users/sjezewski/events{/privacy}","received_events_url":"https://api.github.com/users/sjezewski/received_events","type":"User","site_admin":false},"assignees":[{"login":"sjezewski","id":597953,"avatar_url":"https://avatars1.githubusercontent.com/u/597953?v=4","gravatar_id":"","url":"https://api.github.com/users/sjezewski","html_url":"https://github.com/sjezewski","followers_url":"https://api.github.com/users/sjezewski/followers","following_url":"https://api.github.com/users/sjezewski/following{/other_user}","gists_url":"https://api.github.com/users/sjezewski/gists{/gist_id}","starred_url":"https://api.github.com/users/sjezewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjezewski/subscriptions","organizations_url":"https://api.github.com/users/sjezewski/orgs","repos_url":"https://api.github.com/users/sjezewski/repos","events_url":"https://api.github.com/users/sjezewski/events{/privacy}","received_events_url":"https://api.github.com/users/sjezewski/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794/commits","review_comments_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794/comments","review_comment_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/2794/comments","statuses_url":"https://api.github.com/repos/pachyderm/pachyderm/statuses/8c14df5a1efe5f37b64586814e99db9d01100291","head":{"label":"pachyderm:reset-token","ref":"reset-token","sha":"8c14df5a1efe5f37b64586814e99db9d01100291","user":{"login":"pachyderm","id":10432478,"avatar_url":"https://avatars3.githubusercontent.com/u/10432478?v=4","gravatar_id":"","url":"https://api.github.com/users/pachyderm","html_url":"https://github.com/pachyderm","followers_url":"https://api.github.com/users/pachyderm/followers","following_url":"https://api.github.com/users/pachyderm/following{/other_user}","gists_url":"https://api.github.com/users/pachyderm/gists{/gist_id}","starred_url":"https://api.github.com/users/pachyderm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pachyderm/subscriptions","organizations_url":"https://api.github.com/users/pachyderm/orgs","repos_url":"https://api.github.com/users/pachyderm/repos","events_url":"https://api.github.com/users/pachyderm/events{/privacy}","received_events_url":"https://api.github.com/users/pachyderm/received_events","type":"Organization","site_admin":false},"repo":{"id":23653453,"name":"pachyderm","full_name":"pachyderm/pachyderm","owner":{"login":"pachyderm","id":10432478,"avatar_url":"https://avatars3.githubusercontent.com/u/10432478?v=4","gravatar_id":"","url":"https://api.github.com/users/pachyderm","html_url":"https://github.com/pachyderm","followers_url":"https://api.github.com/users/pachyderm/followers","following_url":"https://api.github.com/users/pachyderm/following{/other_user}","gists_url":"https://api.github.com/users/pachyderm/gists{/gist_id}","starred_url":"https://api.github.com/users/pachyderm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pachyderm/subscriptions","organizations_url":"https://api.github.com/users/pachyderm/orgs","repos_url":"https://api.github.com/users/pachyderm/repos","events_url":"https://api.github.com/users/pachyderm/events{/privacy}","received_events_url":"https://api.github.com/users/pachyderm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pachyderm/pachyderm","description":"Reproducible Data Science at Scale!","fork":false,"url":"https://api.github.com/repos/pachyderm/pachyderm","forks_url":"https://api.github.com/repos/pachyderm/pachyderm/forks","keys_url":"https://api.github.com/repos/pachyderm/pachyderm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pachyderm/pachyderm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pachyderm/pachyderm/teams","hooks_url":"https://api.github.com/repos/pachyderm/pachyderm/hooks","issue_events_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/events{/number}","events_url":"https://api.github.com/repos/pachyderm/pachyderm/events","assignees_url":"https://api.github.com/repos/pachyderm/pachyderm/assignees{/user}","branches_url":"https://api.github.com/repos/pachyderm/pachyderm/branches{/branch}","tags_url":"https://api.github.com/repos/pachyderm/pachyderm/tags","blobs_url":"https://api.github.com/repos/pachyderm/pachyderm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pachyderm/pachyderm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pachyderm/pachyderm/git/refs{/sha}","trees_url":"https://api.github.com/repos/pachyderm/pachyderm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pachyderm/pachyderm/statuses/{sha}","languages_url":"https://api.github.com/repos/pachyderm/pachyderm/languages","stargazers_url":"https://api.github.com/repos/pachyderm/pachyderm/stargazers","contributors_url":"https://api.github.com/repos/pachyderm/pachyderm/contributors","subscribers_url":"https://api.github.com/repos/pachyderm/pachyderm/subscribers","subscription_url":"https://api.github.com/repos/pachyderm/pachyderm/subscription","commits_url":"https://api.github.com/repos/pachyderm/pachyderm/commits{/sha}","git_commits_url":"https://api.github.com/repos/pachyderm/pachyderm/git/commits{/sha}","comments_url":"https://api.github.com/repos/pachyderm/pachyderm/comments{/number}","issue_comment_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/comments{/number}","contents_url":"https://api.github.com/repos/pachyderm/pachyderm/contents/{+path}","compare_url":"https://api.github.com/repos/pachyderm/pachyderm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pachyderm/pachyderm/merges","archive_url":"https://api.github.com/repos/pachyderm/pachyderm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pachyderm/pachyderm/downloads","issues_url":"https://api.github.com/repos/pachyderm/pachyderm/issues{/number}","pulls_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls{/number}","milestones_url":"https://api.github.com/repos/pachyderm/pachyderm/milestones{/number}","notifications_url":"https://api.github.com/repos/pachyderm/pachyderm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pachyderm/pachyderm/labels{/name}","releases_url":"https://api.github.com/repos/pachyderm/pachyderm/releases{/id}","deployments_url":"https://api.github.com/repos/pachyderm/pachyderm/deployments","created_at":"2014-09-04T07:50:02Z","updated_at":"2018-03-20T18:47:43Z","pushed_at":"2018-03-20T22:01:46Z","git_url":"git://github.com/pachyderm/pachyderm.git","ssh_url":"git@github.com:pachyderm/pachyderm.git","clone_url":"https://github.com/pachyderm/pachyderm.git","svn_url":"https://github.com/pachyderm/pachyderm","homepage":"http://pachyderm.io","size":106880,"stargazers_count":2623,"watchers_count":2623,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":259,"mirror_url":null,"archived":false,"open_issues_count":277,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":259,"open_issues":277,"watchers":2623,"default_branch":"master"}},"base":{"label":"pachyderm:master","ref":"master","sha":"b2df162bf394fbfedd056b20442e46fe4e70819f","user":{"login":"pachyderm","id":10432478,"avatar_url":"https://avatars3.githubusercontent.com/u/10432478?v=4","gravatar_id":"","url":"https://api.github.com/users/pachyderm","html_url":"https://github.com/pachyderm","followers_url":"https://api.github.com/users/pachyderm/followers","following_url":"https://api.github.com/users/pachyderm/following{/other_user}","gists_url":"https://api.github.com/users/pachyderm/gists{/gist_id}","starred_url":"https://api.github.com/users/pachyderm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pachyderm/subscriptions","organizations_url":"https://api.github.com/users/pachyderm/orgs","repos_url":"https://api.github.com/users/pachyderm/repos","events_url":"https://api.github.com/users/pachyderm/events{/privacy}","received_events_url":"https://api.github.com/users/pachyderm/received_events","type":"Organization","site_admin":false},"repo":{"id":23653453,"name":"pachyderm","full_name":"pachyderm/pachyderm","owner":{"login":"pachyderm","id":10432478,"avatar_url":"https://avatars3.githubusercontent.com/u/10432478?v=4","gravatar_id":"","url":"https://api.github.com/users/pachyderm","html_url":"https://github.com/pachyderm","followers_url":"https://api.github.com/users/pachyderm/followers","following_url":"https://api.github.com/users/pachyderm/following{/other_user}","gists_url":"https://api.github.com/users/pachyderm/gists{/gist_id}","starred_url":"https://api.github.com/users/pachyderm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pachyderm/subscriptions","organizations_url":"https://api.github.com/users/pachyderm/orgs","repos_url":"https://api.github.com/users/pachyderm/repos","events_url":"https://api.github.com/users/pachyderm/events{/privacy}","received_events_url":"https://api.github.com/users/pachyderm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pachyderm/pachyderm","description":"Reproducible Data Science at Scale!","fork":false,"url":"https://api.github.com/repos/pachyderm/pachyderm","forks_url":"https://api.github.com/repos/pachyderm/pachyderm/forks","keys_url":"https://api.github.com/repos/pachyderm/pachyderm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pachyderm/pachyderm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pachyderm/pachyderm/teams","hooks_url":"https://api.github.com/repos/pachyderm/pachyderm/hooks","issue_events_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/events{/number}","events_url":"https://api.github.com/repos/pachyderm/pachyderm/events","assignees_url":"https://api.github.com/repos/pachyderm/pachyderm/assignees{/user}","branches_url":"https://api.github.com/repos/pachyderm/pachyderm/branches{/branch}","tags_url":"https://api.github.com/repos/pachyderm/pachyderm/tags","blobs_url":"https://api.github.com/repos/pachyderm/pachyderm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pachyderm/pachyderm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pachyderm/pachyderm/git/refs{/sha}","trees_url":"https://api.github.com/repos/pachyderm/pachyderm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pachyderm/pachyderm/statuses/{sha}","languages_url":"https://api.github.com/repos/pachyderm/pachyderm/languages","stargazers_url":"https://api.github.com/repos/pachyderm/pachyderm/stargazers","contributors_url":"https://api.github.com/repos/pachyderm/pachyderm/contributors","subscribers_url":"https://api.github.com/repos/pachyderm/pachyderm/subscribers","subscription_url":"https://api.github.com/repos/pachyderm/pachyderm/subscription","commits_url":"https://api.github.com/repos/pachyderm/pachyderm/commits{/sha}","git_commits_url":"https://api.github.com/repos/pachyderm/pachyderm/git/commits{/sha}","comments_url":"https://api.github.com/repos/pachyderm/pachyderm/comments{/number}","issue_comment_url":"https://api.github.com/repos/pachyderm/pachyderm/issues/comments{/number}","contents_url":"https://api.github.com/repos/pachyderm/pachyderm/contents/{+path}","compare_url":"https://api.github.com/repos/pachyderm/pachyderm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pachyderm/pachyderm/merges","archive_url":"https://api.github.com/repos/pachyderm/pachyderm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pachyderm/pachyderm/downloads","issues_url":"https://api.github.com/repos/pachyderm/pachyderm/issues{/number}","pulls_url":"https://api.github.com/repos/pachyderm/pachyderm/pulls{/number}","milestones_url":"https://api.github.com/repos/pachyderm/pachyderm/milestones{/number}","notifications_url":"https://api.github.com/repos/pachyderm/pachyderm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pachyderm/pachyderm/labels{/name}","releases_url":"https://api.github.com/repos/pachyderm/pachyderm/releases{/id}","deployments_url":"https://api.github.com/repos/pachyderm/pachyderm/deployments","created_at":"2014-09-04T07:50:02Z","updated_at":"2018-03-20T18:47:43Z","pushed_at":"2018-03-20T22:01:46Z","git_url":"git://github.com/pachyderm/pachyderm.git","ssh_url":"git@github.com:pachyderm/pachyderm.git","clone_url":"https://github.com/pachyderm/pachyderm.git","svn_url":"https://github.com/pachyderm/pachyderm","homepage":"http://pachyderm.io","size":106880,"stargazers_count":2623,"watchers_count":2623,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":259,"mirror_url":null,"archived":false,"open_issues_count":277,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":259,"open_issues":277,"watchers":2623,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794"},"html":{"href":"https://github.com/pachyderm/pachyderm/pull/2794"},"issue":{"href":"https://api.github.com/repos/pachyderm/pachyderm/issues/2794"},"comments":{"href":"https://api.github.com/repos/pachyderm/pachyderm/issues/2794/comments"},"review_comments":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794/comments"},"review_comment":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pachyderm/pachyderm/pulls/2794/commits"},"statuses":{"href":"https://api.github.com/repos/pachyderm/pachyderm/statuses/8c14df5a1efe5f37b64586814e99db9d01100291"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sjezewski"}}