Skip to content
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 6 commits into
base: devel
Choose a base branch
from

Conversation

@lukeschlather
Copy link

@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
Copy link
Contributor

@ansibot 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

@Akasurde Akasurde force-pushed the lukeschlather:devel branch to 0c63e41 Jan 17, 2019
@ansibot
Copy link
Contributor

@ansibot ansibot commented Jan 17, 2019

The test ansible-test sanity --test pylint [explain] failed with 3 errors:

lib/ansible/module_utils/basic.py:671:14: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/module_utils/basic.py:684:14: ansible-format-automatic-specification Format string contains automatic field numbering specification
lib/ansible/module_utils/basic.py:684:14: missing-format-argument-key Missing keyword argument '"msg"' for format string

click here for bot help

@ansibot
Copy link
Contributor

@ansibot ansibot commented Jan 17, 2019

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

lib/ansible/module_utils/basic.py:684:14: missing-format-argument-key Missing keyword argument '"msg"' for format string

click here for bot help

@Akasurde
Copy link
Member

@Akasurde Akasurde commented Apr 28, 2021

/azp run

@azure-pipelines
Copy link

@azure-pipelines azure-pipelines bot commented Apr 28, 2021

Azure Pipelines successfully started running 1 pipeline(s).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants