From 1223143ebebd7cd740ead6e98eb487ca697df4cf Mon Sep 17 00:00:00 2001 From: "Tom X. Tobin" Date: Thu, 14 Jan 2016 12:44:05 -0500 Subject: [PATCH] osx_defaults: Fix boolean value parsing Values for boolean types were being unconditionally treated as strings (by calling `.lower()`), thus breaking value parsing for actual boolean and integer objects. It looks like the bug was introduced in: - 130bd670d82cc55fa321021e819838e07ff10c08 Fixes #709. --- lib/ansible/modules/extras/system/osx_defaults.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/system/osx_defaults.py b/lib/ansible/modules/extras/system/osx_defaults.py index 632082b030..0c373d9f87 100644 --- a/lib/ansible/modules/extras/system/osx_defaults.py +++ b/lib/ansible/modules/extras/system/osx_defaults.py @@ -124,9 +124,11 @@ class OSXDefaults(object): if type == "string": return str(value) elif type in ["bool", "boolean"]: - if value.lower() in [True, 1, "true", "1", "yes"]: + if isinstance(value, basestring): + value = value.lower() + if value in [True, 1, "true", "1", "yes"]: return True - elif value.lower() in [False, 0, "false", "0", "no"]: + elif value in [False, 0, "false", "0", "no"]: return False raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value))) elif type == "date":