summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Options.py')
-rw-r--r--src/lib/Bcfg2/Options.py46
1 files changed, 40 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py
index 7c91ca3cc..243c4ed2a 100644
--- a/src/lib/Bcfg2/Options.py
+++ b/src/lib/Bcfg2/Options.py
@@ -308,14 +308,14 @@ def list_split(c_string):
""" split an option string on commas, optionally surrounded by
whitespace, returning a list """
if c_string:
- return re.split("\s*,\s*", c_string)
+ return re.split(r'\s*,\s*', c_string)
return []
def colon_split(c_string):
""" split an option string on colons, returning a list """
if c_string:
- return c_string.split(':')
+ return c_string.split(r':')
return []
@@ -355,7 +355,7 @@ def get_size(value):
'512m', '2g'), get the absolute number of bytes as an integer """
if value == -1:
return value
- mat = re.match("(\d+)([KkMmGg])?", value)
+ mat = re.match(r'(\d+)([KkMmGg])?', value)
if not mat:
raise ValueError("Not a valid size", value)
rvalue = int(mat.group(1))
@@ -401,7 +401,8 @@ CFILE = \
Option('Specify configuration file',
default=DEFAULT_CONFIG_LOCATION,
cmd='-C',
- odesc='<conffile>')
+ odesc='<conffile>',
+ env="BCFG2_CONFIG")
LOCKFILE = \
Option('Specify lockfile',
default='/var/lock/bcfg2.run',
@@ -534,6 +535,11 @@ SERVER_FAM_IGNORE = \
'SCCS', '.svn', '4913', '.gitignore'],
cf=('server', 'ignore_files'),
cook=list_split)
+SERVER_FAM_BLOCK = \
+ Option('FAM blocks on startup until all events are processed',
+ default=False,
+ cook=get_bool,
+ cf=('server', 'fam_blocking'))
SERVER_LISTEN_ALL = \
Option('Listen on all interfaces',
default=False,
@@ -573,7 +579,7 @@ SERVER_PASSWORD = \
SERVER_PROTOCOL = \
Option('Server Protocol',
default='xmlrpc/ssl',
- cf=('communication', 'procotol'))
+ cf=('communication', 'protocol'))
SERVER_BACKEND = \
Option('Server Backend',
default='best',
@@ -603,6 +609,16 @@ SERVER_AUTHENTICATION = \
default='cert+password',
odesc='{cert|bootstrap|cert+password}',
cf=('communication', 'authentication'))
+SERVER_CHILDREN = \
+ Option('Spawn this number of children for the multiprocessing core. '
+ 'By default spawns children equivalent to the number of processors '
+ 'in the machine.',
+ default=None,
+ cmd='--children',
+ odesc='<children>',
+ cf=('server', 'children'),
+ cook=get_int,
+ long_arg=True)
# database options
DB_ENGINE = \
@@ -1082,6 +1098,15 @@ VERBOSE = \
cmd='-v',
cook=get_bool,
cf=('logging', 'verbose'))
+LOG_PERFORMANCE = \
+ Option("Periodically log performance statistics",
+ default=False,
+ cf=('logging', 'performance'))
+PERFLOG_INTERVAL = \
+ Option("Performance statistics logging interval in seconds",
+ default=300.0,
+ cook=get_timeout,
+ cf=('logging', 'performance_interval'))
# Plugin-specific options
CFG_VALIDATION = \
@@ -1156,6 +1181,7 @@ SERVER_COMMON_OPTIONS = dict(repo=SERVER_REPOSITORY,
password=SERVER_PASSWORD,
filemonitor=SERVER_FILEMONITOR,
ignore=SERVER_FAM_IGNORE,
+ fam_blocking=SERVER_FAM_BLOCK,
location=SERVER_LOCATION,
key=SERVER_KEY,
cert=SERVER_CERT,
@@ -1164,7 +1190,10 @@ SERVER_COMMON_OPTIONS = dict(repo=SERVER_REPOSITORY,
web_configfile=WEB_CFILE,
backend=SERVER_BACKEND,
vcs_root=SERVER_VCS_ROOT,
- authentication=SERVER_AUTHENTICATION)
+ authentication=SERVER_AUTHENTICATION,
+ perflog=LOG_PERFORMANCE,
+ perflog_interval=PERFLOG_INTERVAL,
+ children=SERVER_CHILDREN)
CRYPT_OPTIONS = dict(encrypt=ENCRYPT,
decrypt=DECRYPT,
@@ -1269,6 +1298,11 @@ TEST_COMMON_OPTIONS = dict(noseopts=TEST_NOSEOPTS,
xunit=TEST_XUNIT,
validate=CFG_VALIDATION)
+INFO_COMMON_OPTIONS = dict(ppath=PARANOID_PATH,
+ max_copies=PARANOID_MAX_COPIES)
+INFO_COMMON_OPTIONS.update(CLI_COMMON_OPTIONS)
+INFO_COMMON_OPTIONS.update(SERVER_COMMON_OPTIONS)
+
class OptionParser(OptionSet):
"""