summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options.py
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2013-11-12 23:48:25 +0100
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-11-14 09:27:08 -0500
commitd8bbfbdf8b503538fff01bff80c5e6e12bfb44b3 (patch)
tree95b76849268d44bcf6ea81f957159e3a568dcf69 /src/lib/Bcfg2/Options.py
parent557377e8a1d0492f4c26b95c4a74172a9210ac3e (diff)
downloadbcfg2-d8bbfbdf8b503538fff01bff80c5e6e12bfb44b3.tar.gz
bcfg2-d8bbfbdf8b503538fff01bff80c5e6e12bfb44b3.tar.bz2
bcfg2-d8bbfbdf8b503538fff01bff80c5e6e12bfb44b3.zip
Add probes.allowed_groups option to restrict group assignments.
Diffstat (limited to 'src/lib/Bcfg2/Options.py')
-rw-r--r--src/lib/Bcfg2/Options.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index 95abe64ae..f9b6a998b 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -311,6 +311,14 @@ def list_split(c_string):
return re.split(r'\s*,\s*', c_string)
return []
+def list_split_anchored_regex(c_string):
+ """ like list_split but split on whitespace and compile each element as
+ anchored regex """
+ try:
+ return [re.compile('^' + x + '$') for x in re.split(r'\s+', c_string)]
+ except re.error:
+ raise ValueError("Not a list of regexes", c_string)
+
def colon_split(c_string):
""" split an option string on colons, returning a list """
@@ -641,6 +649,12 @@ SERVER_CHILDREN = \
cf=('server', 'children'),
cook=get_int,
long_arg=True)
+SERVER_PROBE_ALLOWED_GROUPS = \
+ Option('Whitespace-separated list of group names (as regex) to which '
+ 'probes can assign a client by writing "group:" to stdout.',
+ default=['.*'],
+ cf=('probes', 'allowed_groups'),
+ cook=list_split_anchored_regex)
# database options
DB_ENGINE = \
@@ -1225,7 +1239,8 @@ SERVER_COMMON_OPTIONS = dict(repo=SERVER_REPOSITORY,
perflog=LOG_PERFORMANCE,
perflog_interval=PERFLOG_INTERVAL,
children=SERVER_CHILDREN,
- client_timeout=CLIENT_TIMEOUT)
+ client_timeout=CLIENT_TIMEOUT,
+ probe_allowed_groups=SERVER_PROBE_ALLOWED_GROUPS)
CRYPT_OPTIONS = dict(encrypt=ENCRYPT,
decrypt=DECRYPT,