1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Small fix for boolean when boolean type was set via a variable (somehow changes the behaviour of Ansible because of YAML as it seems. Booleans then become represented as a string).

This commit is contained in:
Franck Nijhof 2014-10-13 07:34:24 +02:00 committed by Matt Clay
parent 631927c579
commit 5f84fc985d

View file

@ -124,9 +124,9 @@ class OSXDefaults(object):
if type == "string": if type == "string":
return str(value) return str(value)
elif type in ["bool", "boolean"]: elif type in ["bool", "boolean"]:
if value in [True, 1, "true", "1", "yes"]: if value.lower() in [True, 1, "true", "1", "yes"]:
return True return True
elif value in [False, 0, "false", "0", "no"]: elif value.lower() in [False, 0, "false", "0", "no"]:
return False return False
raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value))) raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value)))
elif type == "date": elif type == "date":
@ -191,7 +191,7 @@ class OSXDefaults(object):
rc, out, err = self.module.run_command([self.executable, "read", self.domain, self.key]) rc, out, err = self.module.run_command([self.executable, "read", self.domain, self.key])
# Strip output # Strip output
# out = out.strip() out = out.strip()
# An non zero RC at this point is kinda strange... # An non zero RC at this point is kinda strange...
if rc != 0: if rc != 0: