{"action":"created","comment":{"url":"https://api.github.com/repos/gravitational/teleport/pulls/comments/136226921","pull_request_review_id":59735669,"id":136226921,"diff_hunk":"@@ -281,6 +278,36 @@ func Init(cfg InitConfig, dynamicConfig bool) (*AuthServer, *Identity, error) {\n \treturn asrv, identity, nil\n }\n \n+// setClusterName will set the cluster name resource if it doesn't exist on\n+// the backend. if it does exist on the backend and differs from what is in\n+// the configuration file we will hardfail. if it matches, we do nothing.\n+func setClusterName(cfg InitConfig, asrv *AuthServer) error {\n+\tcn, err := asrv.GetClusterName()\n+\tif err != nil && !trace.IsNotFound(err) {\n+\t\treturn trace.Wrap(err)\n+\t}\n+\n+\t// if nothing is set on the backend, set and return\n+\tif trace.IsNotFound(err) {\n+\t\terr = asrv.SetClusterName(cfg.ClusterName)","path":"lib/auth/init.go","position":44,"original_position":44,"commit_id":"7bf2b5c28f1a29b4ecff40a8a0d608efa87c521a","original_commit_id":"7bf2b5c28f1a29b4ecff40a8a0d608efa87c521a","user":{"login":"russjones","id":5017502,"avatar_url":"https://avatars0.githubusercontent.com/u/5017502?v=4","gravatar_id":"","url":"https://api.github.com/users/russjones","html_url":"https://github.com/russjones","followers_url":"https://api.github.com/users/russjones/followers","following_url":"https://api.github.com/users/russjones/following{/other_user}","gists_url":"https://api.github.com/users/russjones/gists{/gist_id}","starred_url":"https://api.github.com/users/russjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russjones/subscriptions","organizations_url":"https://api.github.com/users/russjones/orgs","repos_url":"https://api.github.com/users/russjones/repos","events_url":"https://api.github.com/users/russjones/events{/privacy}","received_events_url":"https://api.github.com/users/russjones/received_events","type":"User","site_admin":false},"body":"This all occurs under a lock: https://github.com/gravitational/teleport/blob/master/lib/auth/init.go#L121-L125","created_at":"2017-08-31T01:16:19Z","updated_at":"2017-08-31T01:16:19Z","html_url":"https://github.com/gravitational/teleport/pull/1240#discussion_r136226921","pull_request_url":"https://api.github.com/repos/gravitational/teleport/pulls/1240","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/comments/136226921"},"html":{"href":"https://github.com/gravitational/teleport/pull/1240#discussion_r136226921"},"pull_request":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/1240"}},"in_reply_to_id":136226498},"pull_request":{"url":"https://api.github.com/repos/gravitational/teleport/pulls/1240","id":138558021,"html_url":"https://github.com/gravitational/teleport/pull/1240","diff_url":"https://github.com/gravitational/teleport/pull/1240.diff","patch_url":"https://github.com/gravitational/teleport/pull/1240.patch","issue_url":"https://api.github.com/repos/gravitational/teleport/issues/1240","number":1240,"state":"open","locked":false,"title":"Hard fail when trying to update ClusterName.","user":{"login":"russjones","id":5017502,"avatar_url":"https://avatars0.githubusercontent.com/u/5017502?v=4","gravatar_id":"","url":"https://api.github.com/users/russjones","html_url":"https://github.com/russjones","followers_url":"https://api.github.com/users/russjones/followers","following_url":"https://api.github.com/users/russjones/following{/other_user}","gists_url":"https://api.github.com/users/russjones/gists{/gist_id}","starred_url":"https://api.github.com/users/russjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russjones/subscriptions","organizations_url":"https://api.github.com/users/russjones/orgs","repos_url":"https://api.github.com/users/russjones/repos","events_url":"https://api.github.com/users/russjones/events{/privacy}","received_events_url":"https://api.github.com/users/russjones/received_events","type":"User","site_admin":false},"body":"**Purpose**\r\n\r\nThis PR prevents the cluster name from being accidentally being overridden. Once the cluster name is set, if a different cluster name comes from the configuration file, Teleport will fail to start.\r\n\r\n**Implementation**\r\n\r\nUpon startup, Teleport checks if cluster name has been set.\r\n\r\nIf cluster name has not been set on the backend, Teleport will set the cluster name on the backend with what is in the configuration file.\r\n\r\nIf the cluster name has been set on the backend and what is in the configuration file differs from what is in the backend, Teleport will hard fail.\r\n\r\n**Related Issues**\r\n\r\nFixes https://github.com/gravitational/teleport/issues/1098","created_at":"2017-08-31T00:36:51Z","updated_at":"2017-08-31T01:16:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94f1faa19d7af576a01b8c7f5f9c04cb5461fbfc","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kontsevoy","id":461020,"avatar_url":"https://avatars2.githubusercontent.com/u/461020?v=4","gravatar_id":"","url":"https://api.github.com/users/kontsevoy","html_url":"https://github.com/kontsevoy","followers_url":"https://api.github.com/users/kontsevoy/followers","following_url":"https://api.github.com/users/kontsevoy/following{/other_user}","gists_url":"https://api.github.com/users/kontsevoy/gists{/gist_id}","starred_url":"https://api.github.com/users/kontsevoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kontsevoy/subscriptions","organizations_url":"https://api.github.com/users/kontsevoy/orgs","repos_url":"https://api.github.com/users/kontsevoy/repos","events_url":"https://api.github.com/users/kontsevoy/events{/privacy}","received_events_url":"https://api.github.com/users/kontsevoy/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/gravitational/teleport/pulls/1240/commits","review_comments_url":"https://api.github.com/repos/gravitational/teleport/pulls/1240/comments","review_comment_url":"https://api.github.com/repos/gravitational/teleport/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gravitational/teleport/issues/1240/comments","statuses_url":"https://api.github.com/repos/gravitational/teleport/statuses/7bf2b5c28f1a29b4ecff40a8a0d608efa87c521a","head":{"label":"gravitational:rjones/clustername-fx","ref":"rjones/clustername-fx","sha":"7bf2b5c28f1a29b4ecff40a8a0d608efa87c521a","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars2.githubusercontent.com/u/10781132?v=4","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":31558937,"name":"teleport","full_name":"gravitational/teleport","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars2.githubusercontent.com/u/10781132?v=4","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/teleport","description":"Modern SSH server for clusters and teams.","fork":false,"url":"https://api.github.com/repos/gravitational/teleport","forks_url":"https://api.github.com/repos/gravitational/teleport/forks","keys_url":"https://api.github.com/repos/gravitational/teleport/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/teleport/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/teleport/teams","hooks_url":"https://api.github.com/repos/gravitational/teleport/hooks","issue_events_url":"https://api.github.com/repos/gravitational/teleport/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/teleport/events","assignees_url":"https://api.github.com/repos/gravitational/teleport/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/teleport/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/teleport/tags","blobs_url":"https://api.github.com/repos/gravitational/teleport/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/teleport/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/teleport/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/teleport/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/teleport/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/teleport/languages","stargazers_url":"https://api.github.com/repos/gravitational/teleport/stargazers","contributors_url":"https://api.github.com/repos/gravitational/teleport/contributors","subscribers_url":"https://api.github.com/repos/gravitational/teleport/subscribers","subscription_url":"https://api.github.com/repos/gravitational/teleport/subscription","commits_url":"https://api.github.com/repos/gravitational/teleport/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/teleport/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/teleport/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/teleport/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/teleport/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/teleport/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/teleport/merges","archive_url":"https://api.github.com/repos/gravitational/teleport/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/teleport/downloads","issues_url":"https://api.github.com/repos/gravitational/teleport/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/teleport/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/teleport/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/teleport/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/teleport/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/teleport/releases{/id}","deployments_url":"https://api.github.com/repos/gravitational/teleport/deployments","created_at":"2015-03-02T19:36:00Z","updated_at":"2017-08-30T21:26:04Z","pushed_at":"2017-08-31T01:09:17Z","git_url":"git://github.com/gravitational/teleport.git","ssh_url":"git@github.com:gravitational/teleport.git","clone_url":"https://github.com/gravitational/teleport.git","svn_url":"https://github.com/gravitational/teleport","homepage":"http://gravitational.com/teleport","size":40332,"stargazers_count":5187,"watchers_count":5187,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":260,"mirror_url":null,"open_issues_count":68,"forks":260,"open_issues":68,"watchers":5187,"default_branch":"master"}},"base":{"label":"gravitational:master","ref":"master","sha":"8f4b354f5706fb050e7f400a63fe83f4bdbfe0ca","user":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars2.githubusercontent.com/u/10781132?v=4","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"repo":{"id":31558937,"name":"teleport","full_name":"gravitational/teleport","owner":{"login":"gravitational","id":10781132,"avatar_url":"https://avatars2.githubusercontent.com/u/10781132?v=4","gravatar_id":"","url":"https://api.github.com/users/gravitational","html_url":"https://github.com/gravitational","followers_url":"https://api.github.com/users/gravitational/followers","following_url":"https://api.github.com/users/gravitational/following{/other_user}","gists_url":"https://api.github.com/users/gravitational/gists{/gist_id}","starred_url":"https://api.github.com/users/gravitational/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gravitational/subscriptions","organizations_url":"https://api.github.com/users/gravitational/orgs","repos_url":"https://api.github.com/users/gravitational/repos","events_url":"https://api.github.com/users/gravitational/events{/privacy}","received_events_url":"https://api.github.com/users/gravitational/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gravitational/teleport","description":"Modern SSH server for clusters and teams.","fork":false,"url":"https://api.github.com/repos/gravitational/teleport","forks_url":"https://api.github.com/repos/gravitational/teleport/forks","keys_url":"https://api.github.com/repos/gravitational/teleport/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gravitational/teleport/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gravitational/teleport/teams","hooks_url":"https://api.github.com/repos/gravitational/teleport/hooks","issue_events_url":"https://api.github.com/repos/gravitational/teleport/issues/events{/number}","events_url":"https://api.github.com/repos/gravitational/teleport/events","assignees_url":"https://api.github.com/repos/gravitational/teleport/assignees{/user}","branches_url":"https://api.github.com/repos/gravitational/teleport/branches{/branch}","tags_url":"https://api.github.com/repos/gravitational/teleport/tags","blobs_url":"https://api.github.com/repos/gravitational/teleport/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gravitational/teleport/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gravitational/teleport/git/refs{/sha}","trees_url":"https://api.github.com/repos/gravitational/teleport/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gravitational/teleport/statuses/{sha}","languages_url":"https://api.github.com/repos/gravitational/teleport/languages","stargazers_url":"https://api.github.com/repos/gravitational/teleport/stargazers","contributors_url":"https://api.github.com/repos/gravitational/teleport/contributors","subscribers_url":"https://api.github.com/repos/gravitational/teleport/subscribers","subscription_url":"https://api.github.com/repos/gravitational/teleport/subscription","commits_url":"https://api.github.com/repos/gravitational/teleport/commits{/sha}","git_commits_url":"https://api.github.com/repos/gravitational/teleport/git/commits{/sha}","comments_url":"https://api.github.com/repos/gravitational/teleport/comments{/number}","issue_comment_url":"https://api.github.com/repos/gravitational/teleport/issues/comments{/number}","contents_url":"https://api.github.com/repos/gravitational/teleport/contents/{+path}","compare_url":"https://api.github.com/repos/gravitational/teleport/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gravitational/teleport/merges","archive_url":"https://api.github.com/repos/gravitational/teleport/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gravitational/teleport/downloads","issues_url":"https://api.github.com/repos/gravitational/teleport/issues{/number}","pulls_url":"https://api.github.com/repos/gravitational/teleport/pulls{/number}","milestones_url":"https://api.github.com/repos/gravitational/teleport/milestones{/number}","notifications_url":"https://api.github.com/repos/gravitational/teleport/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gravitational/teleport/labels{/name}","releases_url":"https://api.github.com/repos/gravitational/teleport/releases{/id}","deployments_url":"https://api.github.com/repos/gravitational/teleport/deployments","created_at":"2015-03-02T19:36:00Z","updated_at":"2017-08-30T21:26:04Z","pushed_at":"2017-08-31T01:09:17Z","git_url":"git://github.com/gravitational/teleport.git","ssh_url":"git@github.com:gravitational/teleport.git","clone_url":"https://github.com/gravitational/teleport.git","svn_url":"https://github.com/gravitational/teleport","homepage":"http://gravitational.com/teleport","size":40332,"stargazers_count":5187,"watchers_count":5187,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":260,"mirror_url":null,"open_issues_count":68,"forks":260,"open_issues":68,"watchers":5187,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/1240"},"html":{"href":"https://github.com/gravitational/teleport/pull/1240"},"issue":{"href":"https://api.github.com/repos/gravitational/teleport/issues/1240"},"comments":{"href":"https://api.github.com/repos/gravitational/teleport/issues/1240/comments"},"review_comments":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/1240/comments"},"review_comment":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gravitational/teleport/pulls/1240/commits"},"statuses":{"href":"https://api.github.com/repos/gravitational/teleport/statuses/7bf2b5c28f1a29b4ecff40a8a0d608efa87c521a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"russjones"}}