payload: {"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible/pulls/comments/291728907","pull_request_review_id":247273822,"id":291728907,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI5MTcyODkwNw==","diff_hunk":"@@ -399,53 +409,108 @@ def exec_command(self, cmd, in_data=None, sudoable=True):\n \n         cmd = to_bytes(cmd, errors='surrogate_or_strict')\n \n-        no_prompt_out = b''\n-        no_prompt_err = b''\n-        become_output = b''\n+        event = threading.Event()\n+        chan.in_buffer.set_event(event)\n+        chan.in_stderr_buffer.set_event(event)\n \n-        try:\n-            chan.exec_command(cmd)\n-            if self.become and self.become.expect_prompt():\n-                passprompt = False\n-                become_sucess = False\n-                while not (become_sucess or passprompt):\n-                    display.debug('Waiting for Privilege Escalation input')\n+        b_stdout = b_stderr = b''\n+        b_tmp_stdout = b_tmp_stderr = b''\n \n+        chan.exec_command(cmd)\n+        if self.become and self.become.expect_prompt():\n+            while not (self._flags['become_success'] or chan.exit_status_ready()):\n+                event.wait()\n+\n+                if chan.recv_ready():\n                     chunk = chan.recv(bufsize)\n-                    display.debug(\"chunk is: %s\" % chunk)\n-                    if not chunk:\n-                        if b'unknown user' in become_output:\n-                            raise AnsibleError('user %s does not exist' % self._play_context.become_user)\n-                        else:\n-                            break\n-                            # raise AnsibleError('ssh connection closed waiting for password prompt')\n-                    become_output += chunk\n-\n-                    # need to check every line because we might get lectured\n-                    # and we might get the middle of a line in a chunk\n-                    for l in become_output.splitlines(True):\n-                        if self.become.check_success(l):\n-                            become_sucess = True\n-                            break\n-                        elif self.become.check_password_prompt(l):\n-                            passprompt = True\n-                            break\n-\n-                if passprompt:\n+                    display.debug(\"stdout chunk is: %s\" % chunk)\n+                    b_tmp_stdout += chunk\n+\n+                    b_output, b_unprocessed = self._examine_output('stdout', b_tmp_stdout, sudoable)\n+                    b_stdout += b_output\n+                    b_tmp_stdout = b_unprocessed\n+\n+                if chan.recv_stderr_ready():\n+                    chunk = chan.recv_stderr(bufsize)\n+                    display.debug(\"stderr chunk is: %s\" % chunk)\n+                    b_tmp_stderr += chunk\n+\n+                    b_output, b_unprocessed = self._examine_output('stderr', b_tmp_stderr, sudoable)\n+                    b_stderr += b_output\n+                    b_tmp_stderr = b_unprocessed\n+\n+                if self._flags['become_prompt']:","path":"lib/ansible/plugins/connection/paramiko_ssh.py","position":88,"original_position":88,"commit_id":"5e5c69fd6a1387868aaea051323233b035fb5eed","original_commit_id":"5e5c69fd6a1387868aaea051323233b035fb5eed","user":{"login":"webknjaz","id":578543,"node_id":"MDQ6VXNlcjU3ODU0Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/578543?v=4","gravatar_id":"","url":"https://api.github.com/users/webknjaz","html_url":"https://github.com/webknjaz","followers_url":"https://api.github.com/users/webknjaz/followers","following_url":"https://api.github.com/users/webknjaz/following{/other_user}","gists_url":"https://api.github.com/users/webknjaz/gists{/gist_id}","starred_url":"https://api.github.com/users/webknjaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webknjaz/subscriptions","organizations_url":"https://api.github.com/users/webknjaz/orgs","repos_url":"https://api.github.com/users/webknjaz/repos","events_url":"https://api.github.com/users/webknjaz/events{/privacy}","received_events_url":"https://api.github.com/users/webknjaz/received_events","type":"User","site_admin":false},"body":"I don't really like storing flags on the instance level. I think it'd be cleaner if this var was scoped to this method. Or maybe even factor out state store into a separate class (e.g. Enum).","created_at":"2019-06-07T19:40:28Z","updated_at":"2019-06-07T19:40:28Z","html_url":"https://github.com/ansible/ansible/pull/57526#discussion_r291728907","pull_request_url":"https://api.github.com/repos/ansible/ansible/pulls/57526","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments/291728907"},"html":{"href":"https://github.com/ansible/ansible/pull/57526#discussion_r291728907"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible/pulls/57526"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/57526","id":286054316,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjg2MDU0MzE2","html_url":"https://github.com/ansible/ansible/pull/57526","diff_url":"https://github.com/ansible/ansible/pull/57526.diff","patch_url":"https://github.com/ansible/ansible/pull/57526.patch","issue_url":"https://api.github.com/repos/ansible/ansible/issues/57526","number":57526,"state":"open","locked":false,"title":"[WIP] Fixing for #12608 paramiko connection plugin hung with wrong password","user":{"login":"ahlinc","id":14666676,"node_id":"MDQ6VXNlcjE0NjY2Njc2","avatar_url":"https://avatars1.githubusercontent.com/u/14666676?v=4","gravatar_id":"","url":"https://api.github.com/users/ahlinc","html_url":"https://github.com/ahlinc","followers_url":"https://api.github.com/users/ahlinc/followers","following_url":"https://api.github.com/users/ahlinc/following{/other_user}","gists_url":"https://api.github.com/users/ahlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/ahlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahlinc/subscriptions","organizations_url":"https://api.github.com/users/ahlinc/orgs","repos_url":"https://api.github.com/users/ahlinc/repos","events_url":"https://api.github.com/users/ahlinc/events{/privacy}","received_events_url":"https://api.github.com/users/ahlinc/received_events","type":"User","site_admin":false},"body":"Fixes #12608\r\n\r\n##### SUMMARY\r\nIt uses a mechanism available in Paramiko channel buffers to notify\r\nabout new data available for reading. The notification implemented\r\nwith `threading.Event` shared across stdout and stderr buffers. In\r\nthe fix the code just waits for the event, which clears on the\r\nparamiko side on any attempt to read data from the buffers.\r\nPart of the code for the fix was taken from Ansible ssh connection\r\nmodule, maybe this will help to move ssh and paramiko connection\r\nmodules to a shared codebase for the sake of feature parity.\r\n\r\n##### ISSUE TYPE\r\n- Bugfix Pull Request\r\n\r\n##### COMPONENT NAME\r\nParamiko connection plugin\r\n\r\n##### ADDITIONAL INFORMATION\r\nN/A","created_at":"2019-06-07T05:34:43Z","updated_at":"2019-06-07T19:40:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"277ac9bbbbc6a5d2d6408c31fc43d1c77cdc1501","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":529643857,"node_id":"MDU6TGFiZWw1Mjk2NDM4NTc=","url":"https://api.github.com/repos/ansible/ansible/labels/WIP","name":"WIP","color":"fef2c0","default":false},{"id":1316917295,"node_id":"MDU6TGFiZWwxMzE2OTE3Mjk1","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.9","name":"affects_2.9","color":"ededed","default":false},{"id":785271699,"node_id":"MDU6TGFiZWw3ODUyNzE2OTk=","url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":723150340,"node_id":"MDU6TGFiZWw3MjMxNTAzNDA=","url":"https://api.github.com/repos/ansible/ansible/labels/new_contributor","name":"new_contributor","color":"c2e0c6","default":false},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ansible/ansible/pulls/57526/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible/pulls/57526/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/57526/comments","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/5e5c69fd6a1387868aaea051323233b035fb5eed","head":{"label":"ahlinc:bugfix/paramiko_sudo_badpass","ref":"bugfix/paramiko_sudo_badpass","sha":"5e5c69fd6a1387868aaea051323233b035fb5eed","user":{"login":"ahlinc","id":14666676,"node_id":"MDQ6VXNlcjE0NjY2Njc2","avatar_url":"https://avatars1.githubusercontent.com/u/14666676?v=4","gravatar_id":"","url":"https://api.github.com/users/ahlinc","html_url":"https://github.com/ahlinc","followers_url":"https://api.github.com/users/ahlinc/followers","following_url":"https://api.github.com/users/ahlinc/following{/other_user}","gists_url":"https://api.github.com/users/ahlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/ahlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahlinc/subscriptions","organizations_url":"https://api.github.com/users/ahlinc/orgs","repos_url":"https://api.github.com/users/ahlinc/repos","events_url":"https://api.github.com/users/ahlinc/events{/privacy}","received_events_url":"https://api.github.com/users/ahlinc/received_events","type":"User","site_admin":false},"repo":{"id":190692946,"node_id":"MDEwOlJlcG9zaXRvcnkxOTA2OTI5NDY=","name":"ansible","full_name":"ahlinc/ansible","private":false,"owner":{"login":"ahlinc","id":14666676,"node_id":"MDQ6VXNlcjE0NjY2Njc2","avatar_url":"https://avatars1.githubusercontent.com/u/14666676?v=4","gravatar_id":"","url":"https://api.github.com/users/ahlinc","html_url":"https://github.com/ahlinc","followers_url":"https://api.github.com/users/ahlinc/followers","following_url":"https://api.github.com/users/ahlinc/following{/other_user}","gists_url":"https://api.github.com/users/ahlinc/gists{/gist_id}","starred_url":"https://api.github.com/users/ahlinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahlinc/subscriptions","organizations_url":"https://api.github.com/users/ahlinc/orgs","repos_url":"https://api.github.com/users/ahlinc/repos","events_url":"https://api.github.com/users/ahlinc/events{/privacy}","received_events_url":"https://api.github.com/users/ahlinc/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ahlinc/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":true,"url":"https://api.github.com/repos/ahlinc/ansible","forks_url":"https://api.github.com/repos/ahlinc/ansible/forks","keys_url":"https://api.github.com/repos/ahlinc/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahlinc/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahlinc/ansible/teams","hooks_url":"https://api.github.com/repos/ahlinc/ansible/hooks","issue_events_url":"https://api.github.com/repos/ahlinc/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/ahlinc/ansible/events","assignees_url":"https://api.github.com/repos/ahlinc/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/ahlinc/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/ahlinc/ansible/tags","blobs_url":"https://api.github.com/repos/ahlinc/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahlinc/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahlinc/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahlinc/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahlinc/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/ahlinc/ansible/languages","stargazers_url":"https://api.github.com/repos/ahlinc/ansible/stargazers","contributors_url":"https://api.github.com/repos/ahlinc/ansible/contributors","subscribers_url":"https://api.github.com/repos/ahlinc/ansible/subscribers","subscription_url":"https://api.github.com/repos/ahlinc/ansible/subscription","commits_url":"https://api.github.com/repos/ahlinc/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahlinc/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahlinc/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahlinc/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahlinc/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/ahlinc/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahlinc/ansible/merges","archive_url":"https://api.github.com/repos/ahlinc/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahlinc/ansible/downloads","issues_url":"https://api.github.com/repos/ahlinc/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/ahlinc/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/ahlinc/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/ahlinc/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahlinc/ansible/labels{/name}","releases_url":"https://api.github.com/repos/ahlinc/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/ahlinc/ansible/deployments","created_at":"2019-06-07T05:31:10Z","updated_at":"2019-06-07T05:31:48Z","pushed_at":"2019-06-07T18:31:52Z","git_url":"git://github.com/ahlinc/ansible.git","ssh_url":"git@github.com:ahlinc/ansible.git","clone_url":"https://github.com/ahlinc/ansible.git","svn_url":"https://github.com/ahlinc/ansible","homepage":"https://www.ansible.com/","size":161265,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"7d9cac8e4761a2371dad7dc6c01151755598678e","user":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"repo":{"id":3638964,"node_id":"MDEwOlJlcG9zaXRvcnkzNjM4OTY0","name":"ansible","full_name":"ansible/ansible","private":false,"owner":{"login":"ansible","id":1507452,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MDc0NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1507452?v=4","gravatar_id":"","url":"https://api.github.com/users/ansible","html_url":"https://github.com/ansible","followers_url":"https://api.github.com/users/ansible/followers","following_url":"https://api.github.com/users/ansible/following{/other_user}","gists_url":"https://api.github.com/users/ansible/gists{/gist_id}","starred_url":"https://api.github.com/users/ansible/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansible/subscriptions","organizations_url":"https://api.github.com/users/ansible/orgs","repos_url":"https://api.github.com/users/ansible/repos","events_url":"https://api.github.com/users/ansible/events{/privacy}","received_events_url":"https://api.github.com/users/ansible/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ansible/ansible","description":"Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications — automate in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com/ansible/","fork":false,"url":"https://api.github.com/repos/ansible/ansible","forks_url":"https://api.github.com/repos/ansible/ansible/forks","keys_url":"https://api.github.com/repos/ansible/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ansible/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ansible/ansible/teams","hooks_url":"https://api.github.com/repos/ansible/ansible/hooks","issue_events_url":"https://api.github.com/repos/ansible/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/ansible/ansible/events","assignees_url":"https://api.github.com/repos/ansible/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/ansible/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/ansible/ansible/tags","blobs_url":"https://api.github.com/repos/ansible/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ansible/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ansible/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/ansible/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/ansible/ansible/languages","stargazers_url":"https://api.github.com/repos/ansible/ansible/stargazers","contributors_url":"https://api.github.com/repos/ansible/ansible/contributors","subscribers_url":"https://api.github.com/repos/ansible/ansible/subscribers","subscription_url":"https://api.github.com/repos/ansible/ansible/subscription","commits_url":"https://api.github.com/repos/ansible/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/ansible/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/ansible/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/ansible/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/ansible/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/ansible/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ansible/ansible/merges","archive_url":"https://api.github.com/repos/ansible/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ansible/ansible/downloads","issues_url":"https://api.github.com/repos/ansible/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/ansible/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/ansible/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/ansible/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ansible/ansible/labels{/name}","releases_url":"https://api.github.com/repos/ansible/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/ansible/ansible/deployments","created_at":"2012-03-06T14:58:02Z","updated_at":"2019-06-07T19:32:30Z","pushed_at":"2019-06-07T19:40:21Z","git_url":"git://github.com/ansible/ansible.git","ssh_url":"git@github.com:ansible/ansible.git","clone_url":"https://github.com/ansible/ansible.git","svn_url":"https://github.com/ansible/ansible","homepage":"https://www.ansible.com/","size":169192,"stargazers_count":37570,"watchers_count":37570,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15692,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5796,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":15692,"open_issues":5796,"watchers":37570,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/57526"},"html":{"href":"https://github.com/ansible/ansible/pull/57526"},"issue":{"href":"https://api.github.com/repos/ansible/ansible/issues/57526"},"comments":{"href":"https://api.github.com/repos/ansible/ansible/issues/57526/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible/pulls/57526/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible/pulls/57526/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible/statuses/5e5c69fd6a1387868aaea051323233b035fb5eed"}},"author_association":"NONE"}}
other: {"actor":{"display_login":"webknjaz"}}