summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2014-10-31 01:22:38 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2014-10-31 01:22:38 +0100
commit4cf5bdf4fa667605a208bc677c5c56489532ec04 (patch)
tree6c682977b251380566702b83bf9d19ff5a595730
parentb63d3cdce0b977736a9e6496282a30e7aca5fb6e (diff)
downloadbcfg2-4cf5bdf4fa667605a208bc677c5c56489532ec04.tar.gz
bcfg2-4cf5bdf4fa667605a208bc677c5c56489532ec04.tar.bz2
bcfg2-4cf5bdf4fa667605a208bc677c5c56489532ec04.zip
Options/Types: add abbility to set empty lists
We have some lists with default values, so someone maybe want to set an empty list from the config. Previously this was not possible, because an empty string results in a list with an empty string as element. This fixes this problem.
-rw-r--r--src/lib/Bcfg2/Options/Types.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py
index d11e54fba..da54bbcc4 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(':')