From 5a31e049ee342ec5874447796bc3978310306afb Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 3 Jun 2011 13:28:46 -0500 Subject: bcfg2-server: Add the ability to listen on specific interfaces (#1013) Signed-off-by: Sol Jerome --- src/lib/Options.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/lib/Options.py') diff --git a/src/lib/Options.py b/src/lib/Options.py index e6eebb808..9980566fb 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -173,6 +173,18 @@ def colon_split(c_string): return c_string.split(':') return [] +def get_bool(s): + # these values copied from ConfigParser.RawConfigParser.getboolean + # with the addition of True and False + truelist = ["1", "yes", "True", "true", "on"] + falselist = ["0", "no", "False", "false", "off"] + if s in truelist: + return True + elif s in falselist: + return False + else: + raise ValueError + # General options CFILE = Option('Specify configuration file', DEFAULT_CONFIG_LOCATION, cmd='-C', odesc='') @@ -249,6 +261,13 @@ SERVER_MCONNECT = Option('Server Metadata Connector list', cook=list_split, cf=('server', 'connectors'), default=['Probes'], ) SERVER_FILEMONITOR = Option('Server file monitor', cf=('server', 'filemonitor'), default='default', odesc='File monitoring driver') +SERVER_LISTEN_ALL = Option('Listen on all interfaces', + cf=('server', 'listen_all'), + cmd='--listen-all', + default=False, + long_arg=True, + cook=get_bool, + odesc='True|False') SERVER_LOCATION = Option('Server Location', cf=('components', 'bcfg2'), default='https://localhost:6789', cmd='-S', odesc='https://server:port') -- cgit v1.2.3-1-g7c22