From 31f5ecea60ccfd669c29dad2ba6ea38cb93b2284 Mon Sep 17 00:00:00 2001 From: willthames Date: Mon, 13 Jan 2014 14:15:23 +1000 Subject: [PATCH] Allow float as an argument type in AnsibleModule --- lib/ansible/module_utils/basic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 1f4c6250878..29766efb3c3 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -706,6 +706,12 @@ class AnsibleModule(object): self.params[k] = int(value) else: is_invalid = True + elif wanted == 'float': + if not isinstance(value, float): + if isinstance(value, basestring): + self.params[k] = float(value) + else: + is_invalid = True else: self.fail_json(msg="implementation error: unknown type %s requested for %s" % (wanted, k))