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).

pull/18777/head
Franck Nijhof 10 years ago committed by Matt Clay
parent 631927c579
commit 5f84fc985d

@ -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:

Loading…
Cancel
Save