docs: update error message (#81554)

* Reword the error message when the module fails to parse parameters
  in JSON format
* misc typo fixes

Fixes: #81188

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/81889/head
Abhijeet Kasurde 1 year ago committed by GitHub
parent d67d8bd823
commit c0eefa955a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
---
bugfixes:
- Reword the error message when the module fails to parse parameters in JSON format (https://github.com/ansible/ansible/issues/81188).

@ -379,8 +379,8 @@ def _load_params():
try: try:
params = json.loads(buffer.decode('utf-8')) params = json.loads(buffer.decode('utf-8'))
except ValueError: except ValueError:
# This helper used too early for fail_json to work. # This helper is used too early for fail_json to work.
print('\n{"msg": "Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed", "failed": true}') print('\n{"msg": "Error: Module unable to decode stdin/parameters as valid JSON. Unable to parse what parameters were passed", "failed": true}')
sys.exit(1) sys.exit(1)
if PY2: if PY2:
@ -391,7 +391,7 @@ def _load_params():
except KeyError: except KeyError:
# This helper does not have access to fail_json so we have to print # This helper does not have access to fail_json so we have to print
# json output on our own. # json output on our own.
print('\n{"msg": "Error: Module unable to locate ANSIBLE_MODULE_ARGS in json data from stdin. Unable to figure out what parameters were passed", ' print('\n{"msg": "Error: Module unable to locate ANSIBLE_MODULE_ARGS in JSON data from stdin. Unable to figure out what parameters were passed", '
'"failed": true}') '"failed": true}')
sys.exit(1) sys.exit(1)
@ -560,7 +560,7 @@ class AnsibleModule(object):
raise AssertionError("implementation error -- version and date must not both be set") raise AssertionError("implementation error -- version and date must not both be set")
deprecate(msg, version=version, date=date, collection_name=collection_name) deprecate(msg, version=version, date=date, collection_name=collection_name)
# For compatibility, we accept that neither version nor date is set, # For compatibility, we accept that neither version nor date is set,
# and treat that the same as if version would haven been set # and treat that the same as if version would not have been set
if date is not None: if date is not None:
self.log('[DEPRECATION WARNING] %s %s' % (msg, date)) self.log('[DEPRECATION WARNING] %s %s' % (msg, date))
else: else:
@ -687,7 +687,7 @@ class AnsibleModule(object):
def find_mount_point(self, path): def find_mount_point(self, path):
''' '''
Takes a path and returns it's mount point Takes a path and returns its mount point
:param path: a string type with a filesystem path :param path: a string type with a filesystem path
:returns: the path to the mount point as a text type :returns: the path to the mount point as a text type

Loading…
Cancel
Save