{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/46477","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/46477/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/46477/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/46477/events","html_url":"https://github.com/saltstack/salt/pull/46477","id":303993358,"number":46477,"title":"salt-ssh: fix JSON load of return data when it contains non-ascii","user":{"login":"terminalmage","id":328598,"avatar_url":"https://avatars1.githubusercontent.com/u/328598?v=4","gravatar_id":"","url":"https://api.github.com/users/terminalmage","html_url":"https://github.com/terminalmage","followers_url":"https://api.github.com/users/terminalmage/followers","following_url":"https://api.github.com/users/terminalmage/following{/other_user}","gists_url":"https://api.github.com/users/terminalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/terminalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terminalmage/subscriptions","organizations_url":"https://api.github.com/users/terminalmage/orgs","repos_url":"https://api.github.com/users/terminalmage/repos","events_url":"https://api.github.com/users/terminalmage/events{/privacy}","received_events_url":"https://api.github.com/users/terminalmage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-09T21:57:12Z","updated_at":"2018-03-13T12:27:41Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/46477","html_url":"https://github.com/saltstack/salt/pull/46477","diff_url":"https://github.com/saltstack/salt/pull/46477.diff","patch_url":"https://github.com/saltstack/salt/pull/46477.patch"},"body":"For reasons I can't explain, in `salt.utils.json.find_json()` using `.splitlines()` will sometimes convert a unicode string into a list of str types on Python 2. So, that's weird. This can be triggered in salt-ssh whenever there are non-ascii chars in the return data.\r\n\r\n```\r\n[DEBUG] raw = u'{\"local\": {\"return\": {\"foo\": \"\\xf6\\xe4\\xfc\"}}}'\r\n[DEBUG] raw.splitlines() = ['{\"local\": {\"return\": {\"foo\": \"\\xc3\\xb6\\xc3\\xa4\\xc3\\xbc\"}}}']\r\n```\r\n\r\nTo resolve this, the UnicodeDecodeError is caught and reattempted with a decoded list.\r\n\r\nThis fix can be confirmed using a Docker container I have provided:\r\n\r\n```\r\n% docker run --rm -it -v $PWD:/testing terminalmage/issues:46477 sh -c '/usr/sbin/sshd -D & salt-ssh foobar grains.item foo'\r\nfoobar:\r\n    ----------\r\n    foo:\r\n        öäü\r\n```\r\n\r\nThis command should be run from the root of a git clone of Salt, as it will mount the git repo into that container and run salt-ssh from the mounted repo. [This walkthrough](https://help.github.com/articles/checking-out-pull-requests-locally/) can be used to check out this PR into your clone."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/372648242","html_url":"https://github.com/saltstack/salt/pull/46477#issuecomment-372648242","issue_url":"https://api.github.com/repos/saltstack/salt/issues/46477","id":372648242,"user":{"login":"DmitryKuzmenko","id":4807387,"avatar_url":"https://avatars0.githubusercontent.com/u/4807387?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitryKuzmenko","html_url":"https://github.com/DmitryKuzmenko","followers_url":"https://api.github.com/users/DmitryKuzmenko/followers","following_url":"https://api.github.com/users/DmitryKuzmenko/following{/other_user}","gists_url":"https://api.github.com/users/DmitryKuzmenko/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitryKuzmenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitryKuzmenko/subscriptions","organizations_url":"https://api.github.com/users/DmitryKuzmenko/orgs","repos_url":"https://api.github.com/users/DmitryKuzmenko/repos","events_url":"https://api.github.com/users/DmitryKuzmenko/events{/privacy}","received_events_url":"https://api.github.com/users/DmitryKuzmenko/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T12:27:41Z","updated_at":"2018-03-13T12:27:41Z","author_association":"CONTRIBUTOR","body":"Potential fix for centos 6 py2 SSHState tests failures: https://github.com/saltstack/salt-jenkins/issues/805"}}
{"actor":{"display_login":"DmitryKuzmenko"}}