From 8b438fda3ae2d9516dbfb6014c280b68036c17e1 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 30 Jul 2012 10:24:12 -0400 Subject: Metadata and other improvements: * Added support for Client tag in groups.xml * Added support for nested Group tags in groups.xml * Added support for negated groups in groups.xml * Added DatabaseBacked plugin mixin to easily allow plugins to connect to a database specified in global database settings in bcfg2.conf * Added DBMetadata plugin that uses relational DB to store client records instead of writing to clients.xml --- src/lib/Bcfg2/Options.py | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Options.py') diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py index fe1bad110..fb36a985b 100644 --- a/src/lib/Bcfg2/Options.py +++ b/src/lib/Bcfg2/Options.py @@ -224,6 +224,7 @@ def get_bool(s): return False else: raise ValueError + """ Options: @@ -424,6 +425,32 @@ SERVER_BACKEND = \ default='best', cf=('server', 'backend')) +# database options +DB_ENGINE = \ + Option('Database engine', + default='django.db.backends.sqlite3', + cf=('database', 'engine')) +DB_NAME = \ + Option('Database name', + default=os.path.join(SERVER_REPOSITORY.default, "bcfg2.sqlite"), + cf=('database', 'name')) +DB_USER = \ + Option('Database username', + default=None, + cf=('database', 'user')) +DB_PASSWORD = \ + Option('Database password', + default=None, + cf=('database', 'password')) +DB_HOST = \ + Option('Database host', + default='localhost', + cf=('database', 'host')) +DB_PORT = \ + Option('Database port', + default='', + cf=('database', 'port'),) + # Client options CLIENT_KEY = \ Option('Path to SSL key', @@ -898,12 +925,15 @@ class OptionParser(OptionSet): OptionParser bootstraps option parsing, getting the value of the config file """ - def __init__(self, args, argv=None): + def __init__(self, args, argv=None, quiet=False): if argv is None: argv = sys.argv[1:] + # the bootstrap is always quiet, since it's running with a + # default config file and so might produce warnings otherwise self.Bootstrap = OptionSet([('configfile', CFILE)], quiet=True) self.Bootstrap.parse(argv, do_getopt=False) - OptionSet.__init__(self, args, configfile=self.Bootstrap['configfile']) + OptionSet.__init__(self, args, configfile=self.Bootstrap['configfile'], + quiet=quiet) self.optinfo = copy.copy(args) def HandleEvent(self, event): -- cgit v1.2.3-1-g7c22