From 7c31e9544d325bfc869cba1d15cbc57f1d6a9aff Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 19 Jul 2012 17:18:57 -0400 Subject: added CherryPy-based server core --- src/lib/Bcfg2/Options.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/lib/Bcfg2/Options.py') diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py index 1fdfa4274..fe1bad110 100644 --- a/src/lib/Bcfg2/Options.py +++ b/src/lib/Bcfg2/Options.py @@ -252,14 +252,6 @@ HELP = \ Option('Print this usage message', default=False, cmd='-h') -DEBUG = \ - Option("Enable debugging output", - default=False, - cmd='-d') -VERBOSE = \ - Option("Enable verbose output", - default=False, - cmd='-v') DAEMON = \ Option("Daemonize process, storing pid", default=None, @@ -427,6 +419,10 @@ SERVER_PROTOCOL = \ Option('Server Protocol', default='xmlrpc/ssl', cf=('communication', 'procotol')) +SERVER_BACKEND = \ + Option('Server Backend', + default='best', + cf=('server', 'backend')) # Client options CLIENT_KEY = \ @@ -741,6 +737,18 @@ LOGGING_FILE_PATH = \ cmd='-o', odesc='', cf=('logging', 'path')) +DEBUG = \ + Option("Enable debugging output", + default=False, + cmd='-d', + cook=get_bool, + cf=('logging', 'debug')) +VERBOSE = \ + Option("Enable verbose output", + default=False, + cmd='-v', + cook=get_bool, + cf=('logging', 'verbose')) # Plugin-specific options CFG_VALIDATION = \ @@ -810,7 +818,8 @@ SERVER_COMMON_OPTIONS = dict(repo=SERVER_REPOSITORY, key=SERVER_KEY, cert=SERVER_CERT, ca=SERVER_CA, - protocol=SERVER_PROTOCOL) + protocol=SERVER_PROTOCOL, + backend=SERVER_BACKEND) CRYPT_OPTIONS = dict(encrypt=ENCRYPT, decrypt=DECRYPT, @@ -889,9 +898,11 @@ class OptionParser(OptionSet): OptionParser bootstraps option parsing, getting the value of the config file """ - def __init__(self, args): + def __init__(self, args, argv=None): + if argv is None: + argv = sys.argv[1:] self.Bootstrap = OptionSet([('configfile', CFILE)], quiet=True) - self.Bootstrap.parse(sys.argv[1:], do_getopt=False) + self.Bootstrap.parse(argv, do_getopt=False) OptionSet.__init__(self, args, configfile=self.Bootstrap['configfile']) self.optinfo = copy.copy(args) -- cgit v1.2.3-1-g7c22