What is the nature and description of the request?
When executing a custom inventory script with ansible-inventory the output of the script is not seen. If ansible-inventory fails to parse the JSON from the script it will only return an empty pre-formatted JSON response to stdout and fail with this error:
[WARNING]: * Failed to parse /var/lib/awx/projects/_61__project/new_test.py with script plugin: failed to parse executable inventory script results from /var/lib/awx/projects/_61__project/new_test.py: Expecting value: line 1 column 1 (char 0). Expecting value: line 1 column 1 (char 0) File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/script.py", line 150, in parse raise AnsibleParserError(to_native(e))
This error should mean that no JSON was able to be interpreted, but the output of the script is absent. In this script exceptions were added if there were errors upon execution, but they are not seen.
Why does the customer need this? (List the business requirements here)
- Easier troubleshooting of custom inventory scripts instead of a difficult to understand error.
- If a customer includes exceptions inside of the custom script, it's not showing up in the output so it's difficult to know why it's failing.
- Because of how Controller is executing the script it's more difficult to dig into the error if it's not seen and not able to be recreated on the command line.
How would you like to achieve this? (List the functional requirements here)
Include the output of the script when this(or any?) error is seen for the script plugin. Unsure if a specific verbosity level/debug is appropriate for this.