{"action":"closed","number":1,"pull_request":{"url":"https://api.github.com/repos/paetling/docker-py/pulls/1","id":38646076,"html_url":"https://github.com/paetling/docker-py/pull/1","diff_url":"https://github.com/paetling/docker-py/pull/1.diff","patch_url":"https://github.com/paetling/docker-py/pull/1.patch","issue_url":"https://api.github.com/repos/paetling/docker-py/issues/1","number":1,"state":"closed","locked":false,"title":"Fix client.logs(stream=True) for new Docker 1.7 release","user":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"body":"review @theiman \r\n\r\nI have found that client.logs(stream=True) is broken for docker 1.7.  I looked into the docker code base and the reason is line 130 in the file daemon/logs.go:\r\n\r\n```\r\n// write an empty chunk of data (this is to ensure that the\r\n// HTTP Response is sent immediatly, even if the container has\r\n// not yet produced any data)\r\noutStream.Write(nil)\r\n```\r\n\r\nDocker is now writing a nil character to the output stream before it writes any of the streaming data.  This causes the `_multiplexed_response_stream_helper` function to return immediately and not stream the output as desired. \r\n\r\nSolution:\r\nWhat I have found is that when the nil is written by Docker the response has a valid header, it just has a length of 0.    When the container actually closes the header itself does not have a value.  This is an important distinction because it means that your break logic can purely live in the header conditional.  Every other type of check you get means that you can simply continue and wait for the next piece of data. ","created_at":"2015-06-26T12:52:47Z","updated_at":"2015-06-29T14:03:27Z","closed_at":"2015-06-29T14:03:26Z","merged_at":"2015-06-29T14:03:26Z","merge_commit_sha":"879b2c9f64b4957fe7fc81f7a04338e22dc185f7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/paetling/docker-py/pulls/1/commits","review_comments_url":"https://api.github.com/repos/paetling/docker-py/pulls/1/comments","review_comment_url":"https://api.github.com/repos/paetling/docker-py/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paetling/docker-py/issues/1/comments","statuses_url":"https://api.github.com/repos/paetling/docker-py/statuses/032e92f55849f54ee378af02f90cdf51274f5184","head":{"label":"paetling:ae-fix_logs_streaming","ref":"ae-fix_logs_streaming","sha":"032e92f55849f54ee378af02f90cdf51274f5184","user":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"repo":{"id":38110223,"name":"docker-py","full_name":"paetling/docker-py","owner":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paetling/docker-py","description":"An API client for docker written in Python","fork":true,"url":"https://api.github.com/repos/paetling/docker-py","forks_url":"https://api.github.com/repos/paetling/docker-py/forks","keys_url":"https://api.github.com/repos/paetling/docker-py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paetling/docker-py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paetling/docker-py/teams","hooks_url":"https://api.github.com/repos/paetling/docker-py/hooks","issue_events_url":"https://api.github.com/repos/paetling/docker-py/issues/events{/number}","events_url":"https://api.github.com/repos/paetling/docker-py/events","assignees_url":"https://api.github.com/repos/paetling/docker-py/assignees{/user}","branches_url":"https://api.github.com/repos/paetling/docker-py/branches{/branch}","tags_url":"https://api.github.com/repos/paetling/docker-py/tags","blobs_url":"https://api.github.com/repos/paetling/docker-py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paetling/docker-py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paetling/docker-py/git/refs{/sha}","trees_url":"https://api.github.com/repos/paetling/docker-py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paetling/docker-py/statuses/{sha}","languages_url":"https://api.github.com/repos/paetling/docker-py/languages","stargazers_url":"https://api.github.com/repos/paetling/docker-py/stargazers","contributors_url":"https://api.github.com/repos/paetling/docker-py/contributors","subscribers_url":"https://api.github.com/repos/paetling/docker-py/subscribers","subscription_url":"https://api.github.com/repos/paetling/docker-py/subscription","commits_url":"https://api.github.com/repos/paetling/docker-py/commits{/sha}","git_commits_url":"https://api.github.com/repos/paetling/docker-py/git/commits{/sha}","comments_url":"https://api.github.com/repos/paetling/docker-py/comments{/number}","issue_comment_url":"https://api.github.com/repos/paetling/docker-py/issues/comments{/number}","contents_url":"https://api.github.com/repos/paetling/docker-py/contents/{+path}","compare_url":"https://api.github.com/repos/paetling/docker-py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paetling/docker-py/merges","archive_url":"https://api.github.com/repos/paetling/docker-py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paetling/docker-py/downloads","issues_url":"https://api.github.com/repos/paetling/docker-py/issues{/number}","pulls_url":"https://api.github.com/repos/paetling/docker-py/pulls{/number}","milestones_url":"https://api.github.com/repos/paetling/docker-py/milestones{/number}","notifications_url":"https://api.github.com/repos/paetling/docker-py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paetling/docker-py/labels{/name}","releases_url":"https://api.github.com/repos/paetling/docker-py/releases{/id}","created_at":"2015-06-26T12:36:49Z","updated_at":"2015-06-26T12:36:50Z","pushed_at":"2015-06-29T14:03:26Z","git_url":"git://github.com/paetling/docker-py.git","ssh_url":"git@github.com:paetling/docker-py.git","clone_url":"https://github.com/paetling/docker-py.git","svn_url":"https://github.com/paetling/docker-py","homepage":"","size":1609,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"paetling:master","ref":"master","sha":"64dcd5a19179f73077b54d9b25ac5ae8b878b459","user":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"repo":{"id":38110223,"name":"docker-py","full_name":"paetling/docker-py","owner":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paetling/docker-py","description":"An API client for docker written in Python","fork":true,"url":"https://api.github.com/repos/paetling/docker-py","forks_url":"https://api.github.com/repos/paetling/docker-py/forks","keys_url":"https://api.github.com/repos/paetling/docker-py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paetling/docker-py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paetling/docker-py/teams","hooks_url":"https://api.github.com/repos/paetling/docker-py/hooks","issue_events_url":"https://api.github.com/repos/paetling/docker-py/issues/events{/number}","events_url":"https://api.github.com/repos/paetling/docker-py/events","assignees_url":"https://api.github.com/repos/paetling/docker-py/assignees{/user}","branches_url":"https://api.github.com/repos/paetling/docker-py/branches{/branch}","tags_url":"https://api.github.com/repos/paetling/docker-py/tags","blobs_url":"https://api.github.com/repos/paetling/docker-py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paetling/docker-py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paetling/docker-py/git/refs{/sha}","trees_url":"https://api.github.com/repos/paetling/docker-py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paetling/docker-py/statuses/{sha}","languages_url":"https://api.github.com/repos/paetling/docker-py/languages","stargazers_url":"https://api.github.com/repos/paetling/docker-py/stargazers","contributors_url":"https://api.github.com/repos/paetling/docker-py/contributors","subscribers_url":"https://api.github.com/repos/paetling/docker-py/subscribers","subscription_url":"https://api.github.com/repos/paetling/docker-py/subscription","commits_url":"https://api.github.com/repos/paetling/docker-py/commits{/sha}","git_commits_url":"https://api.github.com/repos/paetling/docker-py/git/commits{/sha}","comments_url":"https://api.github.com/repos/paetling/docker-py/comments{/number}","issue_comment_url":"https://api.github.com/repos/paetling/docker-py/issues/comments{/number}","contents_url":"https://api.github.com/repos/paetling/docker-py/contents/{+path}","compare_url":"https://api.github.com/repos/paetling/docker-py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paetling/docker-py/merges","archive_url":"https://api.github.com/repos/paetling/docker-py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paetling/docker-py/downloads","issues_url":"https://api.github.com/repos/paetling/docker-py/issues{/number}","pulls_url":"https://api.github.com/repos/paetling/docker-py/pulls{/number}","milestones_url":"https://api.github.com/repos/paetling/docker-py/milestones{/number}","notifications_url":"https://api.github.com/repos/paetling/docker-py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paetling/docker-py/labels{/name}","releases_url":"https://api.github.com/repos/paetling/docker-py/releases{/id}","created_at":"2015-06-26T12:36:49Z","updated_at":"2015-06-26T12:36:50Z","pushed_at":"2015-06-29T14:03:26Z","git_url":"git://github.com/paetling/docker-py.git","ssh_url":"git@github.com:paetling/docker-py.git","clone_url":"https://github.com/paetling/docker-py.git","svn_url":"https://github.com/paetling/docker-py","homepage":"","size":1609,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paetling/docker-py/pulls/1"},"html":{"href":"https://github.com/paetling/docker-py/pull/1"},"issue":{"href":"https://api.github.com/repos/paetling/docker-py/issues/1"},"comments":{"href":"https://api.github.com/repos/paetling/docker-py/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/paetling/docker-py/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/paetling/docker-py/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paetling/docker-py/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/paetling/docker-py/statuses/032e92f55849f54ee378af02f90cdf51274f5184"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"paetling","id":3281726,"avatar_url":"https://avatars.githubusercontent.com/u/3281726?v=3","gravatar_id":"","url":"https://api.github.com/users/paetling","html_url":"https://github.com/paetling","followers_url":"https://api.github.com/users/paetling/followers","following_url":"https://api.github.com/users/paetling/following{/other_user}","gists_url":"https://api.github.com/users/paetling/gists{/gist_id}","starred_url":"https://api.github.com/users/paetling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paetling/subscriptions","organizations_url":"https://api.github.com/users/paetling/orgs","repos_url":"https://api.github.com/users/paetling/repos","events_url":"https://api.github.com/users/paetling/events{/privacy}","received_events_url":"https://api.github.com/users/paetling/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":1,"additions":2,"deletions":2,"changed_files":1}}