Merge pull request #675 from bcoca/sysctl_nonstrings

now handles non string values for sysctl
This commit is contained in:
Brian Coca 2015-01-21 10:49:47 -05:00
commit 6b784fb28a

View file

@ -185,12 +185,20 @@ class SysctlModule(object):
def _parse_value(self, value):
if value is None:
return ''
elif value.lower() in BOOLEANS_TRUE:
return '1'
elif value.lower() in BOOLEANS_FALSE:
return '0'
elif isinstance(value, bool):
if value:
return '1'
else:
return '0'
elif isinstance(value, basestring):
if value.lower() in BOOLEANS_TRUE:
return '1'
elif value.lower() in BOOLEANS_FALSE:
return '0'
else:
return value.strip()
else:
return value.strip()
return value
# ==============================================================
# SYSCTL COMMAND MANAGEMENT