From 4cf5bdf4fa667605a208bc677c5c56489532ec04 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 31 Oct 2014 01:22:38 +0100 Subject: 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. --- src/lib/Bcfg2/Options/Types.py | 4 ++++ 1 file changed, 4 insertions(+) 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(':') -- cgit v1.2.3-1-g7c22