From ee9ab6c665c5a741b8e34091b1c072ef24b36b81 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Mon, 19 Dec 2016 19:05:03 -0500 Subject: [PATCH] Show valid bool symbols in error for invalid bool symbol --- lib/ansible/module_utils/basic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 9f2ed5f640..6a7846d1ba 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -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"):