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.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Options/Types.py b/src/lib/Bcfg2/Options/Types.py
index 2f0fd7d52..d11e54fba 100644
--- a/src/lib/Bcfg2/Options/Types.py
+++ b/src/lib/Bcfg2/Options/Types.py
@@ -50,6 +50,15 @@ def comma_dict(value):
return result
+def anchored_regex_list(value):
+ """ Split an option string on whitespace and compile each element as
+ an anchored regex """
+ try:
+ return [re.compile('^' + x + '$') for x in re.split(r'\s+', value)]
+ except re.error:
+ raise ValueError("Not a list of regexes", value)
+
+
def octal(value):
""" Given an octal string, get an integer representation. """
return int(value, 8)