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.py33
1 files changed, 22 insertions, 11 deletions
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='<path>',
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)