diff options
author | Michael Fenn <fennm@deshawresearch.com> | 2014-03-21 15:33:30 -0400 |
---|---|---|
committer | Michael Fenn <fennm@deshawresearch.com> | 2014-03-21 15:33:30 -0400 |
commit | 78d938a0bdddf385b1e887ff0a518009ab14b154 (patch) | |
tree | f891fcb558e50de2a34eed8fa437e5c976bf172f /src/lib/Bcfg2/Server/Admin.py | |
parent | de02045a38f13035bb7e372d1ba1d1241e2ea4f0 (diff) | |
download | bcfg2-78d938a0bdddf385b1e887ff0a518009ab14b154.tar.gz bcfg2-78d938a0bdddf385b1e887ff0a518009ab14b154.tar.bz2 bcfg2-78d938a0bdddf385b1e887ff0a518009ab14b154.zip |
Preliminary support for seperate reporting database
This commit implements a Django database router which routes each
Django application to a database whose name matches a key in the database
dict, falling back to the default database if no matching key is found.
This support is plumbed through to the config file via
database.reporting_* database connection config options. These options
mirror ones available for the default database config. If
database.reporting_engine is not specified in the config, then the
configuration falls back to the traditional single-database way of doing
things with the database router becoming a no-op.
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Admin.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py index 27152b867..0807fb2b0 100644 --- a/src/lib/Bcfg2/Server/Admin.py +++ b/src/lib/Bcfg2/Server/Admin.py @@ -912,8 +912,9 @@ if HAS_DJANGO: def run(self, setup): Bcfg2.Server.models.load_models() try: - management.call_command("syncdb", interactive=False, - verbosity=setup.verbose + setup.debug) + Bcfg2.DBSettings.sync_databases( + interactive=False, + verbosity=setup.verbose + setup.debug) except ImproperlyConfigured: err = sys.exc_info()[1] self.logger.error("Django configuration problem: %s" % err) @@ -960,10 +961,10 @@ if HAS_REPORTS: def run(self, setup): verbose = setup.verbose + setup.debug try: - management.call_command("syncdb", interactive=False, - verbosity=verbose) - management.call_command("migrate", interactive=False, - verbosity=verbose) + Bcfg2.DBSettings.sync_databases(interactive=False, + verbosity=verbose) + Bcfg2.DBSettings.migrate_databases(interactive=False, + verbosity=verbose) except: # pylint: disable=W0702 self.errExit("%s failed: %s" % (self.__class__.__name__.title(), |