summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options/Types.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Options/Types.py')
-rw-r--r--src/lib/Bcfg2/Options/Types.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py
index d11e54fba..ac099e135 100644
--- a/src/lib/Bcfg2/Options/Types.py
+++ b/src/lib/Bcfg2/Options/Types.py
@@ -19,12 +19,16 @@ def path(value):
def comma_list(value):
""" Split a comma-delimited list, with optional whitespace around
the commas."""
+ if value == '':
+ return []
return _COMMA_SPLIT_RE.split(value)
def colon_list(value):
""" Split a colon-delimited list. Whitespace is not allowed
around the colons. """
+ if value == '':
+ return []
return value.split(':')
@@ -38,9 +42,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 +113,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)