diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-30 10:24:12 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-30 10:24:12 -0400 |
commit | 8b438fda3ae2d9516dbfb6014c280b68036c17e1 (patch) | |
tree | b8acb22b313e4b57797a227b42f69b95b54bd976 /src/lib/Bcfg2/Server/Core.py | |
parent | 7a008a0b1b4d3b819da5a6544ac15faab3cbb28a (diff) | |
download | bcfg2-8b438fda3ae2d9516dbfb6014c280b68036c17e1.tar.gz bcfg2-8b438fda3ae2d9516dbfb6014c280b68036c17e1.tar.bz2 bcfg2-8b438fda3ae2d9516dbfb6014c280b68036c17e1.zip |
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
Diffstat (limited to 'src/lib/Bcfg2/Server/Core.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Core.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index 1ee01585c..20eee2d7f 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -1,5 +1,6 @@ """Bcfg2.Server.Core provides the runtime support for Bcfg2 modules.""" +import os import atexit import logging import select @@ -9,6 +10,11 @@ import time import inspect import lxml.etree from traceback import format_exc + +# this must be set before we import the Metadata plugin +os.environ['DJANGO_SETTINGS_MODULE'] = 'Bcfg2.settings' + +import Bcfg2.settings import Bcfg2.Server import Bcfg2.Logger import Bcfg2.Server.FileMonitor @@ -95,6 +101,10 @@ class BaseCore(object): # Create an event to signal worker threads to shutdown self.terminate = threading.Event() + # generate Django ORM settings. this must be done _before_ we + # load plugins + Bcfg2.settings.read_config(cfile=self.cfile, repo=self.datastore) + if '' in setup['plugins']: setup['plugins'].remove('') @@ -195,8 +205,7 @@ class BaseCore(object): try: self.plugins[plugin] = plug(self, self.datastore) except PluginInitError: - self.logger.error("Failed to instantiate plugin %s" % plugin, - exc_info=1) + logger.error("Failed to instantiate plugin %s" % plugin, exc_info=1) except: self.logger.error("Unexpected instantiation failure for plugin %s" % plugin, exc_info=1) @@ -526,8 +535,6 @@ class BaseCore(object): def RecvProbeData(self, address, probedata): """Receive probe data from clients.""" client, metadata = self.resolve_client(address) - # clear dynamic groups - self.metadata.cgroups[metadata.hostname] = [] try: xpdata = lxml.etree.XML(probedata.encode('utf-8'), parser=Bcfg2.Server.XMLParser) |