mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Show valid bool symbols in error for invalid bool symbol
This commit is contained in:
parent
eb7495efaf
commit
ee9ab6c665
1 changed files with 3 additions and 2 deletions
|
@ -1687,7 +1687,8 @@ class AnsibleModule(object):
|
||||||
try:
|
try:
|
||||||
self.params[k] = type_checker(value)
|
self.params[k] = type_checker(value)
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
self.fail_json(msg="argument %s is of type %s and we were unable to convert to %s" % (k, type(value), wanted))
|
e = get_exception()
|
||||||
|
self.fail_json(msg="argument %s is of type %s and we were unable to convert to %s: %s" % (k, type(value), wanted, e))
|
||||||
|
|
||||||
def _set_defaults(self, pre=True):
|
def _set_defaults(self, pre=True):
|
||||||
for (k,v) in self.argument_spec.items():
|
for (k,v) in self.argument_spec.items():
|
||||||
|
@ -1879,7 +1880,7 @@ class AnsibleModule(object):
|
||||||
elif arg in BOOLEANS_FALSE:
|
elif arg in BOOLEANS_FALSE:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.fail_json(msg='Boolean %s not in either boolean list' % arg)
|
self.fail_json(msg='%s is not a valid boolean. Valid booleans include: %s' % (to_text(arg), ','.join(['%s' % x for x in BOOLEANS])))
|
||||||
|
|
||||||
def jsonify(self, data):
|
def jsonify(self, data):
|
||||||
for encoding in ("utf-8", "latin-1"):
|
for encoding in ("utf-8", "latin-1"):
|
||||||
|
|
Loading…
Reference in a new issue