Show valid bool symbols in error for invalid bool symbol

pull/20753/head^2
Adrian Likins 8 years ago
parent eb7495efaf
commit ee9ab6c665

@ -1687,7 +1687,8 @@ class AnsibleModule(object):
try:
self.params[k] = type_checker(value)
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):
for (k,v) in self.argument_spec.items():
@ -1879,7 +1880,7 @@ class AnsibleModule(object):
elif arg in BOOLEANS_FALSE:
return False
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):
for encoding in ("utf-8", "latin-1"):

Loading…
Cancel
Save