{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/fleet/pulls/comments/29303918","id":29303918,"diff_hunk":"@@ -262,6 +262,26 @@ func main() {\n \t\tos.Exit(2)\n \t}\n \n+\tvisited := make(map[string]struct{}, 0)\n+\tglobalFlagset.Visit(func(f *flag.Flag) { visited[f.Name] = struct{}{} })\n+\n+\t// if --driver is not set, but --endpoint looks like an etcd\n+\t// server, set the driver to etcd\n+\tif _, ok := visited[\"driver\"]; !ok {\n+\t\tif _, ok = visited[\"endpoint\"]; ok {\n+\t\t\tif eps := strings.Split(globalFlags.Endpoint, \",\"); len(eps) >= 1 {\n+\t\t\t\tif u, err := url.Parse(eps[0]); err == nil {\n+\t\t\t\t\tif _, port, err := net.SplitHostPort(u.Host); err == nil {\n+\t\t\t\t\t\tif port == \"4001\" || port == \"2379\" {\n+\t\t\t\t\t\t\tlog.Debugf(\"Defaulting to --driver=%s as --endpoint appears to be etcd\", clientDriverEtcd)","path":"fleetctl/fleetctl.go","position":15,"original_position":15,"commit_id":"c6131a4465e5f38ef5dd2caa82eb812d908527e7","original_commit_id":"c6131a4465e5f38ef5dd2caa82eb812d908527e7","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"body":"deal with it","created_at":"2015-04-29T01:07:38Z","updated_at":"2015-04-29T01:07:38Z","html_url":"https://github.com/coreos/fleet/pull/1205#discussion_r29303918","pull_request_url":"https://api.github.com/repos/coreos/fleet/pulls/1205","_links":{"self":{"href":"https://api.github.com/repos/coreos/fleet/pulls/comments/29303918"},"html":{"href":"https://github.com/coreos/fleet/pull/1205#discussion_r29303918"},"pull_request":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1205"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/fleet/pulls/1205","id":34326372,"html_url":"https://github.com/coreos/fleet/pull/1205","diff_url":"https://github.com/coreos/fleet/pull/1205.diff","patch_url":"https://github.com/coreos/fleet/pull/1205.patch","issue_url":"https://api.github.com/repos/coreos/fleet/issues/1205","number":1205,"state":"open","locked":false,"title":"fleetctl: set --driver=etcd if --endpoint is etcd-like","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"body":"There is one remaining wart of the switch from --driver=etcd to --driver=API. If someone had been using fleetctl with a custom endpoint like so:\r\n\r\n```\r\nfleetctl --endpoint http://example.com:4001 list-machines\r\n```\r\n\r\nThey now all of a sudden get directed to the fleet API rather than etcd. Given that we can tell (based on the port) that the user wants to use etcd, the default of --driver in this case should remain \"etcd\".","created_at":"2015-04-29T01:01:27Z","updated_at":"2015-04-29T01:07:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90377454bb77b0bbe94da895130682457a1678b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/fleet/pulls/1205/commits","review_comments_url":"https://api.github.com/repos/coreos/fleet/pulls/1205/comments","review_comment_url":"https://api.github.com/repos/coreos/fleet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coreos/fleet/issues/1205/comments","statuses_url":"https://api.github.com/repos/coreos/fleet/statuses/c6131a4465e5f38ef5dd2caa82eb812d908527e7","head":{"label":"bcwaldon:default-driver","ref":"default-driver","sha":"c6131a4465e5f38ef5dd2caa82eb812d908527e7","user":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"repo":{"id":14316614,"name":"fleet","full_name":"bcwaldon/fleet","owner":{"login":"bcwaldon","id":548759,"avatar_url":"https://avatars.githubusercontent.com/u/548759?v=3","gravatar_id":"","url":"https://api.github.com/users/bcwaldon","html_url":"https://github.com/bcwaldon","followers_url":"https://api.github.com/users/bcwaldon/followers","following_url":"https://api.github.com/users/bcwaldon/following{/other_user}","gists_url":"https://api.github.com/users/bcwaldon/gists{/gist_id}","starred_url":"https://api.github.com/users/bcwaldon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcwaldon/subscriptions","organizations_url":"https://api.github.com/users/bcwaldon/orgs","repos_url":"https://api.github.com/users/bcwaldon/repos","events_url":"https://api.github.com/users/bcwaldon/events{/privacy}","received_events_url":"https://api.github.com/users/bcwaldon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bcwaldon/fleet","description":"","fork":true,"url":"https://api.github.com/repos/bcwaldon/fleet","forks_url":"https://api.github.com/repos/bcwaldon/fleet/forks","keys_url":"https://api.github.com/repos/bcwaldon/fleet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bcwaldon/fleet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bcwaldon/fleet/teams","hooks_url":"https://api.github.com/repos/bcwaldon/fleet/hooks","issue_events_url":"https://api.github.com/repos/bcwaldon/fleet/issues/events{/number}","events_url":"https://api.github.com/repos/bcwaldon/fleet/events","assignees_url":"https://api.github.com/repos/bcwaldon/fleet/assignees{/user}","branches_url":"https://api.github.com/repos/bcwaldon/fleet/branches{/branch}","tags_url":"https://api.github.com/repos/bcwaldon/fleet/tags","blobs_url":"https://api.github.com/repos/bcwaldon/fleet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bcwaldon/fleet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bcwaldon/fleet/git/refs{/sha}","trees_url":"https://api.github.com/repos/bcwaldon/fleet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bcwaldon/fleet/statuses/{sha}","languages_url":"https://api.github.com/repos/bcwaldon/fleet/languages","stargazers_url":"https://api.github.com/repos/bcwaldon/fleet/stargazers","contributors_url":"https://api.github.com/repos/bcwaldon/fleet/contributors","subscribers_url":"https://api.github.com/repos/bcwaldon/fleet/subscribers","subscription_url":"https://api.github.com/repos/bcwaldon/fleet/subscription","commits_url":"https://api.github.com/repos/bcwaldon/fleet/commits{/sha}","git_commits_url":"https://api.github.com/repos/bcwaldon/fleet/git/commits{/sha}","comments_url":"https://api.github.com/repos/bcwaldon/fleet/comments{/number}","issue_comment_url":"https://api.github.com/repos/bcwaldon/fleet/issues/comments{/number}","contents_url":"https://api.github.com/repos/bcwaldon/fleet/contents/{+path}","compare_url":"https://api.github.com/repos/bcwaldon/fleet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bcwaldon/fleet/merges","archive_url":"https://api.github.com/repos/bcwaldon/fleet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bcwaldon/fleet/downloads","issues_url":"https://api.github.com/repos/bcwaldon/fleet/issues{/number}","pulls_url":"https://api.github.com/repos/bcwaldon/fleet/pulls{/number}","milestones_url":"https://api.github.com/repos/bcwaldon/fleet/milestones{/number}","notifications_url":"https://api.github.com/repos/bcwaldon/fleet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bcwaldon/fleet/labels{/name}","releases_url":"https://api.github.com/repos/bcwaldon/fleet/releases{/id}","created_at":"2013-11-11T23:26:02Z","updated_at":"2015-03-26T23:35:06Z","pushed_at":"2015-04-29T00:57:54Z","git_url":"git://github.com/bcwaldon/fleet.git","ssh_url":"git@github.com:bcwaldon/fleet.git","clone_url":"https://github.com/bcwaldon/fleet.git","svn_url":"https://github.com/bcwaldon/fleet","homepage":null,"size":8391,"stargazers_count":3,"watchers_count":3,"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":3,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"c52d5176181e4331ffee20efee0914b2404d6dad","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":13512328,"name":"fleet","full_name":"coreos/fleet","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/fleet","description":"A Distributed init System","fork":false,"url":"https://api.github.com/repos/coreos/fleet","forks_url":"https://api.github.com/repos/coreos/fleet/forks","keys_url":"https://api.github.com/repos/coreos/fleet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/fleet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/fleet/teams","hooks_url":"https://api.github.com/repos/coreos/fleet/hooks","issue_events_url":"https://api.github.com/repos/coreos/fleet/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/fleet/events","assignees_url":"https://api.github.com/repos/coreos/fleet/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/fleet/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/fleet/tags","blobs_url":"https://api.github.com/repos/coreos/fleet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/fleet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/fleet/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/fleet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/fleet/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/fleet/languages","stargazers_url":"https://api.github.com/repos/coreos/fleet/stargazers","contributors_url":"https://api.github.com/repos/coreos/fleet/contributors","subscribers_url":"https://api.github.com/repos/coreos/fleet/subscribers","subscription_url":"https://api.github.com/repos/coreos/fleet/subscription","commits_url":"https://api.github.com/repos/coreos/fleet/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/fleet/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/fleet/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/fleet/issues/comments{/number}","contents_url":"https://api.github.com/repos/coreos/fleet/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/fleet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/fleet/merges","archive_url":"https://api.github.com/repos/coreos/fleet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/fleet/downloads","issues_url":"https://api.github.com/repos/coreos/fleet/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/fleet/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/fleet/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/fleet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/fleet/labels{/name}","releases_url":"https://api.github.com/repos/coreos/fleet/releases{/id}","created_at":"2013-10-11T23:56:38Z","updated_at":"2015-04-29T00:18:12Z","pushed_at":"2015-04-29T01:01:27Z","git_url":"git://github.com/coreos/fleet.git","ssh_url":"git@github.com:coreos/fleet.git","clone_url":"https://github.com/coreos/fleet.git","svn_url":"https://github.com/coreos/fleet","homepage":"","size":12067,"stargazers_count":1711,"watchers_count":1711,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":184,"mirror_url":null,"open_issues_count":107,"forks":184,"open_issues":107,"watchers":1711,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1205"},"html":{"href":"https://github.com/coreos/fleet/pull/1205"},"issue":{"href":"https://api.github.com/repos/coreos/fleet/issues/1205"},"comments":{"href":"https://api.github.com/repos/coreos/fleet/issues/1205/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1205/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/fleet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1205/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/fleet/statuses/c6131a4465e5f38ef5dd2caa82eb812d908527e7"}}}}