From ea67db8ab3a8b5222ba938d6227db12b200167e4 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 1 May 2012 14:48:38 -0400 Subject: Bcfg2.Options.list_split only strips whitespace around commas (this allows, e.g., ignoring entries in bcfg2-test that have spaces in the filename) --- src/lib/Bcfg2/Options.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Options.py') diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py index f6273924a..dc14eaf00 100644 --- a/src/lib/Bcfg2/Options.py +++ b/src/lib/Bcfg2/Options.py @@ -1,6 +1,7 @@ """Option parsing library for utilities.""" import getopt +import re import os import sys import shlex @@ -171,8 +172,10 @@ class OptionSet(dict): val = option.value self[key] = val -list_split = lambda x:x.replace(' ','').split(',') -flist_split = lambda x:list_split(x.replace(':', '').lower()) +def list_split(c_string): + if c_string: + return re.split("\s*,\s*", c_string) + return [] def colon_split(c_string): if c_string: -- cgit v1.2.3-1-g7c22