summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options/Types.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-11-11 14:50:22 -0600
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-11-11 14:50:22 -0600
commit77cf4a56b3b7ff8cd466705b968abb539efa703f (patch)
tree9769d560cce0dacda0360dfc434f33774cb01f5e /src/lib/Bcfg2/Options/Types.py
parent389ce1a86b704222ddc9458cd49c281e7601b803 (diff)
parent30634d07d5489f260f37cc86d150315f02c40865 (diff)
downloadbcfg2-77cf4a56b3b7ff8cd466705b968abb539efa703f.tar.gz
bcfg2-77cf4a56b3b7ff8cd466705b968abb539efa703f.tar.bz2
bcfg2-77cf4a56b3b7ff8cd466705b968abb539efa703f.zip
Merge pull request #211 from stpierre/options-unit-tests
Options unit tests
Diffstat (limited to 'src/lib/Bcfg2/Options/Types.py')
-rw-r--r--src/lib/Bcfg2/Options/Types.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py
index d11e54fba..1c04fede3 100644
--- a/src/lib/Bcfg2/Options/Types.py
+++ b/src/lib/Bcfg2/Options/Types.py
@@ -38,9 +38,11 @@ def comma_dict(value):
for item in items:
if '=' in item:
key, value = item.split(r'=', 1)
- try:
- result[key] = bool(value)
- except ValueError:
+ if value in ["true", "yes", "on"]:
+ result[key] = True
+ elif value in ["false", "no", "off"]:
+ result[key] = False
+ else:
try:
result[key] = int(value)
except ValueError:
@@ -107,8 +109,6 @@ def size(value):
""" Given a number of bytes in a human-readable format (e.g.,
'512m', '2g'), get the absolute number of bytes as an integer.
"""
- if value == -1:
- return value
mat = _bytes_re.match(value)
if not mat:
raise ValueError("Not a valid size", value)