{"action":"created","comment":{"url":"https://api.github.com/repos/flynn/flynn/pulls/comments/42039197","id":42039197,"diff_hunk":"@@ -195,3 +206,60 @@ func runClusterDefault(args *docopt.Args) error {\n \tlog.Printf(\"%q is now the default cluster.\", name)\n \treturn nil\n }\n+\n+func runClusterMigrateDomain(args *docopt.Args) error {\n+\tclient, err := getClusterClient()\n+\tif err != nil {\n+\t\tshutdown.Fatal(err)\n+\t}\n+\n+\tdm := &ct.DomainMigration{\n+\t\tDomain: args.String[\"<domain>\"],\n+\t}\n+\n+\trelease, err := client.GetAppRelease(\"controller\")\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tdm.OldDomain = release.Env[\"DEFAULT_ROUTE_DOMAIN\"]\n+\n+\tif !promptYesNo(fmt.Sprintf(`Migrate cluster domain from \"%s\" to \"%s\"?`, dm.OldDomain, dm.Domain)) {\n+\t\tfmt.Println(\"Aborted\")\n+\t\treturn nil\n+\t}\n+\n+\tevents := make(chan *ct.Event)\n+\tstream, err := client.StreamEvents(controller.StreamEventsOptions{\n+\t\tObjectTypes: []ct.EventType{ct.EventTypeDomainMigration},\n+\t}, events)\n+\tif err != nil {\n+\t\treturn nil\n+\t}\n+\tdefer stream.Close()\n+\n+\tif err := client.PutDomain(dm); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tfor {\n+\t\tselect {\n+\t\tcase event, ok := <-events:\n+\t\t\tif !ok {\n+\t\t\t\treturn stream.Err()\n+\t\t\t}\n+\t\t\tvar e *ct.DomainMigrationEvent\n+\t\t\tif err := json.Unmarshal(event.Data, &e); err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\t\t\tif e.Error != \"\" {\n+\t\t\t\tfmt.Println(e.Error)\n+\t\t\t}\n+\t\t\tif e.DomainMigration.FinishedAt != nil {\n+\t\t\t\tfmt.Printf(\"Changed cluster domain from \\\"%s\\\" to \\\"%s\\\"\\n\", dm.OldDomain, dm.Domain)\n+\t\t\t\treturn nil\n+\t\t\t}\n+\t\tcase <-time.After(2 * time.Minute):","path":"cli/cluster.go","position":104,"original_position":104,"commit_id":"d11901fdc0615ec9cfdd19b4ba2da132a7f5a66e","original_commit_id":"d11901fdc0615ec9cfdd19b4ba2da132a7f5a66e","user":{"login":"lmars","id":488515,"avatar_url":"https://avatars.githubusercontent.com/u/488515?v=3","gravatar_id":"","url":"https://api.github.com/users/lmars","html_url":"https://github.com/lmars","followers_url":"https://api.github.com/users/lmars/followers","following_url":"https://api.github.com/users/lmars/following{/other_user}","gists_url":"https://api.github.com/users/lmars/gists{/gist_id}","starred_url":"https://api.github.com/users/lmars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmars/subscriptions","organizations_url":"https://api.github.com/users/lmars/orgs","repos_url":"https://api.github.com/users/lmars/repos","events_url":"https://api.github.com/users/lmars/events{/privacy}","received_events_url":"https://api.github.com/users/lmars/received_events","type":"User","site_admin":false},"body":"Given this could take up to 2 mins without giving any output, we may want to warn the user so they don't `ctrl-c`, e.g.:\r\n\r\n```\r\nmigrating domain (this can take up to 2 minutes)...\r\n```\r\n\r\nor we could print something every few seconds (e.g. `.`).","created_at":"2015-10-14T19:15:15Z","updated_at":"2015-10-14T19:15:15Z","html_url":"https://github.com/flynn/flynn/pull/1957#discussion_r42039197","pull_request_url":"https://api.github.com/repos/flynn/flynn/pulls/1957","_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn/pulls/comments/42039197"},"html":{"href":"https://github.com/flynn/flynn/pull/1957#discussion_r42039197"},"pull_request":{"href":"https://api.github.com/repos/flynn/flynn/pulls/1957"}}},"pull_request":{"url":"https://api.github.com/repos/flynn/flynn/pulls/1957","id":47207418,"html_url":"https://github.com/flynn/flynn/pull/1957","diff_url":"https://github.com/flynn/flynn/pull/1957.diff","patch_url":"https://github.com/flynn/flynn/pull/1957.patch","issue_url":"https://api.github.com/repos/flynn/flynn/issues/1957","number":1957,"state":"open","locked":false,"title":"Migrate cluster domain","user":{"login":"jvatic","id":171040,"avatar_url":"https://avatars.githubusercontent.com/u/171040?v=3","gravatar_id":"","url":"https://api.github.com/users/jvatic","html_url":"https://github.com/jvatic","followers_url":"https://api.github.com/users/jvatic/followers","following_url":"https://api.github.com/users/jvatic/following{/other_user}","gists_url":"https://api.github.com/users/jvatic/gists{/gist_id}","starred_url":"https://api.github.com/users/jvatic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvatic/subscriptions","organizations_url":"https://api.github.com/users/jvatic/orgs","repos_url":"https://api.github.com/users/jvatic/repos","events_url":"https://api.github.com/users/jvatic/events{/privacy}","received_events_url":"https://api.github.com/users/jvatic/received_events","type":"User","site_admin":false},"body":"- [x] Test / Add integration test\r\n- [x] Expose via cli command\r\n\r\n#1816 ","created_at":"2015-10-08T21:15:04Z","updated_at":"2015-10-14T19:15:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12d8edc6644b732ccc986885dc1f215ef141987c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flynn/flynn/pulls/1957/commits","review_comments_url":"https://api.github.com/repos/flynn/flynn/pulls/1957/comments","review_comment_url":"https://api.github.com/repos/flynn/flynn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flynn/flynn/issues/1957/comments","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/d11901fdc0615ec9cfdd19b4ba2da132a7f5a66e","head":{"label":"flynn:migrate-cluster-domain","ref":"migrate-cluster-domain","sha":"d11901fdc0615ec9cfdd19b4ba2da132a7f5a66e","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":11290232,"name":"flynn","full_name":"flynn/flynn","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn","description":"A next generation open source platform as a service (PaaS)","fork":false,"url":"https://api.github.com/repos/flynn/flynn","forks_url":"https://api.github.com/repos/flynn/flynn/forks","keys_url":"https://api.github.com/repos/flynn/flynn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn/teams","hooks_url":"https://api.github.com/repos/flynn/flynn/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn/events","assignees_url":"https://api.github.com/repos/flynn/flynn/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn/tags","blobs_url":"https://api.github.com/repos/flynn/flynn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn/subscription","commits_url":"https://api.github.com/repos/flynn/flynn/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn/merges","archive_url":"https://api.github.com/repos/flynn/flynn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn/downloads","issues_url":"https://api.github.com/repos/flynn/flynn/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn/releases{/id}","created_at":"2013-07-09T18:22:06Z","updated_at":"2015-10-14T19:12:25Z","pushed_at":"2015-10-14T19:03:18Z","git_url":"git://github.com/flynn/flynn.git","ssh_url":"git@github.com:flynn/flynn.git","clone_url":"https://github.com/flynn/flynn.git","svn_url":"https://github.com/flynn/flynn","homepage":"https://flynn.io","size":59139,"stargazers_count":3932,"watchers_count":3932,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":282,"mirror_url":null,"open_issues_count":220,"forks":282,"open_issues":220,"watchers":3932,"default_branch":"master"}},"base":{"label":"flynn:master","ref":"master","sha":"dbeea41e62d2febb79913b551504f441fb031303","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":11290232,"name":"flynn","full_name":"flynn/flynn","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn","description":"A next generation open source platform as a service (PaaS)","fork":false,"url":"https://api.github.com/repos/flynn/flynn","forks_url":"https://api.github.com/repos/flynn/flynn/forks","keys_url":"https://api.github.com/repos/flynn/flynn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn/teams","hooks_url":"https://api.github.com/repos/flynn/flynn/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn/events","assignees_url":"https://api.github.com/repos/flynn/flynn/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn/tags","blobs_url":"https://api.github.com/repos/flynn/flynn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn/subscription","commits_url":"https://api.github.com/repos/flynn/flynn/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn/merges","archive_url":"https://api.github.com/repos/flynn/flynn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn/downloads","issues_url":"https://api.github.com/repos/flynn/flynn/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn/releases{/id}","created_at":"2013-07-09T18:22:06Z","updated_at":"2015-10-14T19:12:25Z","pushed_at":"2015-10-14T19:03:18Z","git_url":"git://github.com/flynn/flynn.git","ssh_url":"git@github.com:flynn/flynn.git","clone_url":"https://github.com/flynn/flynn.git","svn_url":"https://github.com/flynn/flynn","homepage":"https://flynn.io","size":59139,"stargazers_count":3932,"watchers_count":3932,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":282,"mirror_url":null,"open_issues_count":220,"forks":282,"open_issues":220,"watchers":3932,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn/pulls/1957"},"html":{"href":"https://github.com/flynn/flynn/pull/1957"},"issue":{"href":"https://api.github.com/repos/flynn/flynn/issues/1957"},"comments":{"href":"https://api.github.com/repos/flynn/flynn/issues/1957/comments"},"review_comments":{"href":"https://api.github.com/repos/flynn/flynn/pulls/1957/comments"},"review_comment":{"href":"https://api.github.com/repos/flynn/flynn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flynn/flynn/pulls/1957/commits"},"statuses":{"href":"https://api.github.com/repos/flynn/flynn/statuses/d11901fdc0615ec9cfdd19b4ba2da132a7f5a66e"}}}}