From 27b2ae8ddccae5a4ab6f4f7088e2fea77661b709 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Fri, 28 Sep 2012 17:51:59 +0200 Subject: [PATCH] Fix to make sure only strings are being joined Since BOOLEANS also contains integers, joining the list returns an error. Easy to test by giving a wrong value to a boolean argument: service name=httpd enabled=True Since True is not in the allowed BOOLEANS, it will cause the error, which in its turn bails out because it joins strings and integers. We may want to remove the integers from the choices since '0' and '1' are already in the list as strings. Personally I would expect only strings as arguments, not sure where these could be integers ?? --- lib/ansible/module_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index c0b1adb4e1f..69d5392a980 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -173,7 +173,7 @@ class AnsibleModule(object): if type(choices) == list: if k in self.params: if self.params[k] not in choices: - choices_str=",".join(choices) + choices_str=",".join([str(c) for c in choices]) msg="value of %s must be one of: %s, got: %s" % (k, choices_str, self.params[k]) self.fail_json(msg=msg) else: