New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message to be more accurate and include more debugging info #19363

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@lukeschlather

lukeschlather commented Dec 15, 2016

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

lib/ansible/module_utils/basic.py

ANSIBLE VERSION

2.3

SUMMARY

I ran into an issue where my module wasn't getting passed valid JSON. I'm still not sure why that is, but I was derailed for hours by this message which inaccurately claims it tried to pull arguments from stdin.

Below is a slightly redacted version (removed argument names/values I don't want to share) of the error message. You can see it looks like the args file is being created with invalid JSON (it looks like the buffer read in is missing an opening brace and possibly a key). Beyond this pull request, I'd appreciate ideas on why that might be.

"module_stdout": "\n{\"msg\": \"Error: Module unable to decode valid JSON.  Unable to figure out what parameters were passed\", \"failed\": true, \"json_source\": \"file\", \"json_file\":\"/home/myusername/.ansible/tmp/ansible-tmp-1481760801.8551576-394256050499/args\", \"buffer_contents\":\"_ansible_no_log=False  _ansible_verbosity=3 _ansible_module_name=my_module   _ansible_syslog_facility=LOG_USER _ansible_version=2.3.0 _ansible_selinux_special_fs='['\"'\"'fuse'\"'\"', '\"'\"'nfs'\"'\"', '\"'\"'vboxsf'\"'\"', '\"'\"'ramfs'\"'\"']'  _ansible_check_mode=False _ansible_diff=False _ansible_debug=False  \"}\n",
@ansibot

This comment has been minimized.

Contributor

ansibot commented Apr 11, 2017

@lukeschlather Greetings! Thanks for taking the time to open this pullrequest. In order for the community to handle your pullrequest effectively, we need a bit more information.

Here are the items we could not find in your description:

  • issue type

Please set the description of this pullrequest with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/PULL_REQUEST_TEMPLATE.md

click here for bot help

@gundalow

This comment has been minimized.

Contributor

gundalow commented Nov 30, 2018

Kicking CI

@ansibot ansibot removed the stale_ci label Nov 30, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Nov 30, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/basic.py:714:18: ansible-format-automatic-specification Format string contains automatic field numbering specification

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/module_utils/basic.py:714:161: E501 line too long (247 > 160 characters)

click here for bot help

@ansibot ansibot added needs_revision and removed core_review labels Nov 30, 2018

@ansibot ansibot added the stale_ci label Dec 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment