{"action":"created","comment":{"url":"https://api.github.com/repos/ansible/ansible/pulls/comments/59809841","id":59809841,"diff_hunk":"@@ -1435,11 +1435,22 @@ def _set_fallbacks(self):\n \n     def _load_params(self):\n         ''' read the input and set the params attribute.  Sets the constants as well.'''\n-        # Avoid tracebacks when locale is non-utf8\n-        if sys.version_info < (3,):\n-            buffer = sys.stdin.read()\n+        # debug overrides to read args from file or cmdline\n+        if len(sys.argv) > 1:\n+            if os.path.isfile(sys.argv[1]):\n+                fd = open(sys.argv[1], 'rb')\n+                buffer = fd.read()\n+                fd.close()\n+            else:\n+                buffer = sys.argv[1]\n+        # default case, read from stdin\n         else:\n-            buffer = sys.stdin.buffer.read()\n+            if sys.version_info < (3,):","path":"lib/ansible/module_utils/basic.py","position":18,"original_position":18,"commit_id":"c0fe0b49628948cfd472c6afbd9f6054ed61e3bd","original_commit_id":"59c4f0143f35710383e1ef7e27061ffa06aea872","user":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"body":"Ah -- but the comment isn't about the try except.  It's about reading via the bytes interfaces here so that we get raw bytes in and then transform them to unicode ourselves later.  (ie: the comment is to explain why we use open([..] 'rb'), and stdin.buffer on PY3.","created_at":"2016-04-14T23:43:52Z","updated_at":"2016-04-14T23:43:52Z","html_url":"https://github.com/ansible/ansible/pull/15419#discussion_r59809841","pull_request_url":"https://api.github.com/repos/ansible/ansible/pulls/15419","_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments/59809841"},"html":{"href":"https://github.com/ansible/ansible/pull/15419#discussion_r59809841"},"pull_request":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15419"}}},"pull_request":{"url":"https://api.github.com/repos/ansible/ansible/pulls/15419","id":66511666,"html_url":"https://github.com/ansible/ansible/pull/15419","diff_url":"https://github.com/ansible/ansible/pull/15419.diff","patch_url":"https://github.com/ansible/ansible/pull/15419.patch","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15419","number":15419,"state":"open","locked":false,"title":"add _load_params debug overrides for module args/file passed on cmdline","user":{"login":"nitzmahone","id":6775756,"avatar_url":"https://avatars.githubusercontent.com/u/6775756?v=3","gravatar_id":"","url":"https://api.github.com/users/nitzmahone","html_url":"https://github.com/nitzmahone","followers_url":"https://api.github.com/users/nitzmahone/followers","following_url":"https://api.github.com/users/nitzmahone/following{/other_user}","gists_url":"https://api.github.com/users/nitzmahone/gists{/gist_id}","starred_url":"https://api.github.com/users/nitzmahone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitzmahone/subscriptions","organizations_url":"https://api.github.com/users/nitzmahone/orgs","repos_url":"https://api.github.com/users/nitzmahone/repos","events_url":"https://api.github.com/users/nitzmahone/events{/privacy}","received_events_url":"https://api.github.com/users/nitzmahone/received_events","type":"User","site_admin":false},"body":"##### ISSUE TYPE\r\n - Feature Pull Request\r\n\r\n##### SUMMARY\r\n\r\nAdds overrides to module_utils basic.py _load_params to allow module args to be passed via a filepath or JSON on cmdline (makes for easier debugging in many cases). \r\n","created_at":"2016-04-14T16:11:03Z","updated_at":"2016-04-14T23:43:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"623ee962a5cb65c3ec41e521ab66ae3e5aac7d4c","assignee":null,"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/6","html_url":"https://github.com/ansible/ansible/milestones/2.1.0","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/6/labels","id":995714,"number":6,"title":"2.1.0","description":"","creator":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"open_issues":113,"closed_issues":126,"state":"open","created_at":"2015-02-25T19:26:53Z","updated_at":"2016-04-14T21:13:48Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/ansible/ansible/pulls/15419/commits","review_comments_url":"https://api.github.com/repos/ansible/ansible/pulls/15419/comments","review_comment_url":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15419/comments","statuses_url":"https://api.github.com/repos/ansible/ansible/statuses/c0fe0b49628948cfd472c6afbd9f6054ed61e3bd","head":{"label":"nitzmahone:module_debug_arg_override","ref":"module_debug_arg_override","sha":"c0fe0b49628948cfd472c6afbd9f6054ed61e3bd","user":{"login":"nitzmahone","id":6775756,"avatar_url":"https://avatars.githubusercontent.com/u/6775756?v=3","gravatar_id":"","url":"https://api.github.com/users/nitzmahone","html_url":"https://github.com/nitzmahone","followers_url":"https://api.github.com/users/nitzmahone/followers","following_url":"https://api.github.com/users/nitzmahone/following{/other_user}","gists_url":"https://api.github.com/users/nitzmahone/gists{/gist_id}","starred_url":"https://api.github.com/users/nitzmahone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitzmahone/subscriptions","organizations_url":"https://api.github.com/users/nitzmahone/orgs","repos_url":"https://api.github.com/users/nitzmahone/repos","events_url":"https://api.github.com/users/nitzmahone/events{/privacy}","received_events_url":"https://api.github.com/users/nitzmahone/received_events","type":"User","site_admin":false},"repo":{"id":25990854,"name":"ansible","full_name":"nitzmahone/ansible","owner":{"login":"nitzmahone","id":6775756,"avatar_url":"https://avatars.githubusercontent.com/u/6775756?v=3","gravatar_id":"","url":"https://api.github.com/users/nitzmahone","html_url":"https://github.com/nitzmahone","followers_url":"https://api.github.com/users/nitzmahone/followers","following_url":"https://api.github.com/users/nitzmahone/following{/other_user}","gists_url":"https://api.github.com/users/nitzmahone/gists{/gist_id}","starred_url":"https://api.github.com/users/nitzmahone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitzmahone/subscriptions","organizations_url":"https://api.github.com/users/nitzmahone/orgs","repos_url":"https://api.github.com/users/nitzmahone/repos","events_url":"https://api.github.com/users/nitzmahone/events{/privacy}","received_events_url":"https://api.github.com/users/nitzmahone/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nitzmahone/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.","fork":true,"url":"https://api.github.com/repos/nitzmahone/ansible","forks_url":"https://api.github.com/repos/nitzmahone/ansible/forks","keys_url":"https://api.github.com/repos/nitzmahone/ansible/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nitzmahone/ansible/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nitzmahone/ansible/teams","hooks_url":"https://api.github.com/repos/nitzmahone/ansible/hooks","issue_events_url":"https://api.github.com/repos/nitzmahone/ansible/issues/events{/number}","events_url":"https://api.github.com/repos/nitzmahone/ansible/events","assignees_url":"https://api.github.com/repos/nitzmahone/ansible/assignees{/user}","branches_url":"https://api.github.com/repos/nitzmahone/ansible/branches{/branch}","tags_url":"https://api.github.com/repos/nitzmahone/ansible/tags","blobs_url":"https://api.github.com/repos/nitzmahone/ansible/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nitzmahone/ansible/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nitzmahone/ansible/git/refs{/sha}","trees_url":"https://api.github.com/repos/nitzmahone/ansible/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nitzmahone/ansible/statuses/{sha}","languages_url":"https://api.github.com/repos/nitzmahone/ansible/languages","stargazers_url":"https://api.github.com/repos/nitzmahone/ansible/stargazers","contributors_url":"https://api.github.com/repos/nitzmahone/ansible/contributors","subscribers_url":"https://api.github.com/repos/nitzmahone/ansible/subscribers","subscription_url":"https://api.github.com/repos/nitzmahone/ansible/subscription","commits_url":"https://api.github.com/repos/nitzmahone/ansible/commits{/sha}","git_commits_url":"https://api.github.com/repos/nitzmahone/ansible/git/commits{/sha}","comments_url":"https://api.github.com/repos/nitzmahone/ansible/comments{/number}","issue_comment_url":"https://api.github.com/repos/nitzmahone/ansible/issues/comments{/number}","contents_url":"https://api.github.com/repos/nitzmahone/ansible/contents/{+path}","compare_url":"https://api.github.com/repos/nitzmahone/ansible/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nitzmahone/ansible/merges","archive_url":"https://api.github.com/repos/nitzmahone/ansible/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nitzmahone/ansible/downloads","issues_url":"https://api.github.com/repos/nitzmahone/ansible/issues{/number}","pulls_url":"https://api.github.com/repos/nitzmahone/ansible/pulls{/number}","milestones_url":"https://api.github.com/repos/nitzmahone/ansible/milestones{/number}","notifications_url":"https://api.github.com/repos/nitzmahone/ansible/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nitzmahone/ansible/labels{/name}","releases_url":"https://api.github.com/repos/nitzmahone/ansible/releases{/id}","deployments_url":"https://api.github.com/repos/nitzmahone/ansible/deployments","created_at":"2014-10-30T21:39:53Z","updated_at":"2014-11-04T00:01:56Z","pushed_at":"2016-04-14T23:10:08Z","git_url":"git://github.com/nitzmahone/ansible.git","ssh_url":"git@github.com:nitzmahone/ansible.git","clone_url":"https://github.com/nitzmahone/ansible.git","svn_url":"https://github.com/nitzmahone/ansible","homepage":"http://ansible.com/","size":40852,"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":"devel"}},"base":{"label":"ansible:devel","ref":"devel","sha":"e75077fb23461cb6a8c11e6c3a3c1b0e42f97ddc","user":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","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,"name":"ansible","full_name":"ansible/ansible","owner":{"login":"ansible","id":1507452,"avatar_url":"https://avatars.githubusercontent.com/u/1507452?v=3","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},"private":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.","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":"2016-04-14T23:35:00Z","pushed_at":"2016-04-14T23:10:09Z","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":"http://ansible.com/","size":55839,"stargazers_count":16270,"watchers_count":16270,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4862,"mirror_url":null,"open_issues_count":1316,"forks":4862,"open_issues":1316,"watchers":16270,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15419"},"html":{"href":"https://github.com/ansible/ansible/pull/15419"},"issue":{"href":"https://api.github.com/repos/ansible/ansible/issues/15419"},"comments":{"href":"https://api.github.com/repos/ansible/ansible/issues/15419/comments"},"review_comments":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15419/comments"},"review_comment":{"href":"https://api.github.com/repos/ansible/ansible/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ansible/ansible/pulls/15419/commits"},"statuses":{"href":"https://api.github.com/repos/ansible/ansible/statuses/c0fe0b49628948cfd472c6afbd9f6054ed61e3bd"}}}}