{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/123191534","pull_request_review_id":45368841,"id":123191534,"diff_hunk":"@@ -0,0 +1,285 @@\n+package dockerhelper\n+\n+import (\n+\t\"fmt\"\n+\t\"io\"\n+\t\"io/ioutil\"\n+\t\"time\"\n+\n+\t\"golang.org/x/net/context\"\n+\n+\t\"github.com/docker/docker/pkg/stdcopy\"\n+\t\"github.com/docker/engine-api/client\"\n+\t\"github.com/docker/engine-api/types\"\n+\t\"github.com/docker/engine-api/types/container\"\n+\t\"github.com/docker/engine-api/types/network\"\n+)\n+\n+const (\n+\t// defaultDockerOpTimeout is the default timeout of short running docker operations.\n+\tdefaultDockerOpTimeout = 10 * time.Minute\n+)\n+\n+// NewClient creates an instance of the client Interface, given a docker engine\n+// client\n+func NewClient(endpoint string, client *client.Client) Interface {\n+\treturn &dockerClient{\n+\t\tendpoint: endpoint,\n+\t\tclient:   client,\n+\t}\n+}\n+\n+type dockerClient struct {\n+\tendpoint string\n+\tclient   *client.Client\n+}\n+\n+type operationTimeout struct {\n+\terr error\n+}\n+\n+func (e operationTimeout) Error() string {\n+\treturn fmt.Sprintf(\"operation timeout: %v\", e.err)\n+}\n+\n+func (c *dockerClient) Endpoint() string {\n+\treturn c.endpoint\n+}\n+\n+func (c *dockerClient) ServerVersion() (*types.Version, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tversion, err := c.client.ServerVersion(ctx)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn nil, ctxErr\n+\t}\n+\treturn &version, err\n+}\n+\n+func (c *dockerClient) Info() (*types.Info, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tinfo, err := c.client.Info(ctx)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn nil, ctxErr\n+\t}\n+\treturn &info, err\n+}\n+\n+func (c *dockerClient) ContainerList(options types.ContainerListOptions) ([]types.Container, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tcontainers, err := c.client.ContainerList(ctx, options)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn nil, ctxErr\n+\t}\n+\treturn containers, err\n+}\n+\n+func (c *dockerClient) ContainerCreate(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, name string) (*types.ContainerCreateResponse, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tresponse, err := c.client.ContainerCreate(ctx, config, hostConfig, networkingConfig, name)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn nil, ctxErr\n+\t}\n+\treturn &response, err\n+}\n+\n+func (c *dockerClient) ContainerInspect(container string) (*types.ContainerJSON, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tresponse, err := c.client.ContainerInspect(ctx, container)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn nil, ctxErr\n+\t}\n+\treturn &response, err\n+}\n+\n+func (c *dockerClient) ContainerRemove(container string, options types.ContainerRemoveOptions) error {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\terr := c.client.ContainerRemove(ctx, container, options)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn ctxErr\n+\t}\n+\treturn err\n+}\n+\n+func (c *dockerClient) ContainerLogs(container string, options types.ContainerLogsOptions, stdOut, stdErr io.Writer) error {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\tresponse, err := c.client.ContainerLogs(ctx, container, options)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn ctxErr\n+\t}\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\tdefer response.Close()\n+\treturn redirectResponseToOutputStream(stdOut, stdErr, response)\n+}\n+\n+func (c *dockerClient) ContainerStart(container string) error {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\terr := c.client.ContainerStart(ctx, container)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn ctxErr\n+\t}\n+\treturn err\n+}\n+\n+func (c *dockerClient) ContainerStop(container string, timeout int) error {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\terr := c.client.ContainerStop(ctx, container, timeout)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn ctxErr\n+\t}\n+\treturn err\n+}\n+\n+func (c *dockerClient) ContainerWait(container string) (int, error) {\n+\tctx, cancel := defaultContext()\n+\tdefer cancel()\n+\trc, err := c.client.ContainerWait(ctx, container)\n+\tif ctxErr := contextError(ctx); ctxErr != nil {\n+\t\treturn 0, ctxErr\n+\t}\n+\treturn rc, err\n+}\n+\n+func (c *dockerClient) CopyToContainer(container string, dest string, src io.Reader, options types.CopyToContainerOptions) error {\n+\treturn c.client.CopyToContainer(context.Background(), container, dest, src, options)\n+}\n+\n+func (c *dockerClient) CopyFromContainer(container string, src string, dest io.Writer) error {","path":"pkg/bootstrap/docker/dockerhelper/client.go","position":157,"original_position":157,"commit_id":"d1777b0a2001210d847622c4e591241ddca1be65","original_commit_id":"d1777b0a2001210d847622c4e591241ddca1be65","user":{"login":"jim-minter","id":1038301,"avatar_url":"https://avatars1.githubusercontent.com/u/1038301?v=3","gravatar_id":"","url":"https://api.github.com/users/jim-minter","html_url":"https://github.com/jim-minter","followers_url":"https://api.github.com/users/jim-minter/followers","following_url":"https://api.github.com/users/jim-minter/following{/other_user}","gists_url":"https://api.github.com/users/jim-minter/gists{/gist_id}","starred_url":"https://api.github.com/users/jim-minter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jim-minter/subscriptions","organizations_url":"https://api.github.com/users/jim-minter/orgs","repos_url":"https://api.github.com/users/jim-minter/repos","events_url":"https://api.github.com/users/jim-minter/events{/privacy}","received_events_url":"https://api.github.com/users/jim-minter/received_events","type":"User","site_admin":false},"body":"Suggest you return all the values from c.client.CopyFromContainer straight.  Then you get rid of the io.Copy here, and the goroutine, pipe and io.Copy in newContainerDownloader.","created_at":"2017-06-21T09:03:18Z","updated_at":"2017-06-21T09:03:18Z","html_url":"https://github.com/openshift/origin/pull/14729#discussion_r123191534","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/14729","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/123191534"},"html":{"href":"https://github.com/openshift/origin/pull/14729#discussion_r123191534"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/14729"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/14729","id":126190254,"html_url":"https://github.com/openshift/origin/pull/14729","diff_url":"https://github.com/openshift/origin/pull/14729.diff","patch_url":"https://github.com/openshift/origin/pull/14729.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/14729","number":14729,"state":"open","locked":false,"title":"cluster up: use docker engine-api client","user":{"login":"csrwng","id":5834976,"avatar_url":"https://avatars2.githubusercontent.com/u/5834976?v=3","gravatar_id":"","url":"https://api.github.com/users/csrwng","html_url":"https://github.com/csrwng","followers_url":"https://api.github.com/users/csrwng/followers","following_url":"https://api.github.com/users/csrwng/following{/other_user}","gists_url":"https://api.github.com/users/csrwng/gists{/gist_id}","starred_url":"https://api.github.com/users/csrwng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csrwng/subscriptions","organizations_url":"https://api.github.com/users/csrwng/orgs","repos_url":"https://api.github.com/users/csrwng/repos","events_url":"https://api.github.com/users/csrwng/events{/privacy}","received_events_url":"https://api.github.com/users/csrwng/received_events","type":"User","site_admin":false},"body":"Switches cluster up from the fsouza go docker client to the docker engine-api client\r\nFixes https://github.com/openshift/origin/issues/14546\r\n","created_at":"2017-06-18T14:13:57Z","updated_at":"2017-06-21T09:03:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92372bf5b7ad21f0f98b78748e2c822a66fd68e9","assignee":{"login":"bparees","id":4974046,"avatar_url":"https://avatars1.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"assignees":[{"login":"bparees","id":4974046,"avatar_url":"https://avatars1.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/14729/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/14729/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/14729/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/d1777b0a2001210d847622c4e591241ddca1be65","head":{"label":"csrwng:clusterup_docker_engine","ref":"clusterup_docker_engine","sha":"d1777b0a2001210d847622c4e591241ddca1be65","user":{"login":"csrwng","id":5834976,"avatar_url":"https://avatars2.githubusercontent.com/u/5834976?v=3","gravatar_id":"","url":"https://api.github.com/users/csrwng","html_url":"https://github.com/csrwng","followers_url":"https://api.github.com/users/csrwng/followers","following_url":"https://api.github.com/users/csrwng/following{/other_user}","gists_url":"https://api.github.com/users/csrwng/gists{/gist_id}","starred_url":"https://api.github.com/users/csrwng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csrwng/subscriptions","organizations_url":"https://api.github.com/users/csrwng/orgs","repos_url":"https://api.github.com/users/csrwng/repos","events_url":"https://api.github.com/users/csrwng/events{/privacy}","received_events_url":"https://api.github.com/users/csrwng/received_events","type":"User","site_admin":false},"repo":{"id":23592505,"name":"origin","full_name":"csrwng/origin","owner":{"login":"csrwng","id":5834976,"avatar_url":"https://avatars2.githubusercontent.com/u/5834976?v=3","gravatar_id":"","url":"https://api.github.com/users/csrwng","html_url":"https://github.com/csrwng","followers_url":"https://api.github.com/users/csrwng/followers","following_url":"https://api.github.com/users/csrwng/following{/other_user}","gists_url":"https://api.github.com/users/csrwng/gists{/gist_id}","starred_url":"https://api.github.com/users/csrwng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csrwng/subscriptions","organizations_url":"https://api.github.com/users/csrwng/orgs","repos_url":"https://api.github.com/users/csrwng/repos","events_url":"https://api.github.com/users/csrwng/events{/privacy}","received_events_url":"https://api.github.com/users/csrwng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/csrwng/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/csrwng/origin","forks_url":"https://api.github.com/repos/csrwng/origin/forks","keys_url":"https://api.github.com/repos/csrwng/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/csrwng/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/csrwng/origin/teams","hooks_url":"https://api.github.com/repos/csrwng/origin/hooks","issue_events_url":"https://api.github.com/repos/csrwng/origin/issues/events{/number}","events_url":"https://api.github.com/repos/csrwng/origin/events","assignees_url":"https://api.github.com/repos/csrwng/origin/assignees{/user}","branches_url":"https://api.github.com/repos/csrwng/origin/branches{/branch}","tags_url":"https://api.github.com/repos/csrwng/origin/tags","blobs_url":"https://api.github.com/repos/csrwng/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/csrwng/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/csrwng/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/csrwng/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/csrwng/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/csrwng/origin/languages","stargazers_url":"https://api.github.com/repos/csrwng/origin/stargazers","contributors_url":"https://api.github.com/repos/csrwng/origin/contributors","subscribers_url":"https://api.github.com/repos/csrwng/origin/subscribers","subscription_url":"https://api.github.com/repos/csrwng/origin/subscription","commits_url":"https://api.github.com/repos/csrwng/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/csrwng/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/csrwng/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/csrwng/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/csrwng/origin/contents/{+path}","compare_url":"https://api.github.com/repos/csrwng/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/csrwng/origin/merges","archive_url":"https://api.github.com/repos/csrwng/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/csrwng/origin/downloads","issues_url":"https://api.github.com/repos/csrwng/origin/issues{/number}","pulls_url":"https://api.github.com/repos/csrwng/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/csrwng/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/csrwng/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/csrwng/origin/labels{/name}","releases_url":"https://api.github.com/repos/csrwng/origin/releases{/id}","deployments_url":"https://api.github.com/repos/csrwng/origin/deployments","created_at":"2014-09-02T19:29:25Z","updated_at":"2016-01-11T13:43:26Z","pushed_at":"2017-06-19T22:29:51Z","git_url":"git://github.com/csrwng/origin.git","ssh_url":"git@github.com:csrwng/origin.git","clone_url":"https://github.com/csrwng/origin.git","svn_url":"https://github.com/csrwng/origin","homepage":"https://openshift.github.io","size":687306,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"c217470811a2b5ea2f16707bedb6a061dfae1797","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"Enterprise Kubernetes for Developers","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin/deployments","created_at":"2014-07-30T20:04:05Z","updated_at":"2017-06-21T08:49:51Z","pushed_at":"2017-06-21T08:55:24Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":696630,"stargazers_count":2968,"watchers_count":2968,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1985,"mirror_url":null,"open_issues_count":1310,"forks":1985,"open_issues":1310,"watchers":2968,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/14729"},"html":{"href":"https://github.com/openshift/origin/pull/14729"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/14729"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/14729/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/14729/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/14729/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/d1777b0a2001210d847622c4e591241ddca1be65"}}}}
{"actor":{"display_login":"jim-minter"}}