diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-12-31 11:21:10 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-12-31 11:21:10 +0000 |
commit | ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af (patch) | |
tree | 57bf0854d95c18cced379921657f746ad5faab04 /src/lib/Server/Core.py | |
parent | 104a1e27cee2d5524460d26c83d3e920cd88b2e9 (diff) | |
download | bcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.tar.gz bcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.tar.bz2 bcfg2-ef5051726a3aa1f0192bd8d99c5c5b1ee9f067af.zip |
Switch over to more Options usage and complete tests (everything appears to work now)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4142 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Core.py')
-rw-r--r-- | src/lib/Server/Core.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py index 7e347bc23..56f4087dd 100644 --- a/src/lib/Server/Core.py +++ b/src/lib/Server/Core.py @@ -4,11 +4,12 @@ __revision__ = '$Revision$' from time import time from Bcfg2.Server.Plugin import PluginInitError, PluginExecutionError from Bcfg2.Server.Statistics import Statistics -from Bcfg2.Settings import settings -import logging, lxml.etree, os, stat, ConfigParser +import logging, lxml.etree, os, stat import Bcfg2.Server.Plugins.Metadata +import Bcfg2.Options + logger = logging.getLogger('Bcfg2.Core') def ShouldIgnore(event): @@ -199,9 +200,18 @@ except ImportError: class Core(object): '''The Core object is the container for all Bcfg2 Server logic, and modules''' + options = {'repo': Bcfg2.Options.SERVER_REPOSITORY, + 'svn': Bcfg2.Options.SERVER_SVN, + 'structures': Bcfg2.Options.SERVER_STRUCTURES, + 'generators': Bcfg2.Options.SERVER_GENERATORS, + 'password': Bcfg2.Options.SERVER_PASSWORD} + def __init__(self): object.__init__(self) - self.datastore = settings.SERVER_REPOSITORY + opts = Bcfg2.Options.OptionParser(self.options) + opts.parse([]) + self.datastore = opts['repo'] + self.opts = opts try: self.fam = monitor() except IOError: @@ -213,19 +223,17 @@ class Core(object): self.plugins = {} self.revision = '-1' + self.svn = opts['svn'] try: - if settings.SERVER_SVN: + if self.svn: self.read_svn_revision() except: - settings.SERVER_SVN = False - - self.svn = settings.SERVER_SVN + self.svn = False - mpath = settings.SERVER_REPOSITORY - self.stats = Statistics("%s/etc/statistics.xml" % (mpath)) + self.stats = Statistics("%s/etc/statistics.xml" % (self.datastore)) - structures = settings.SERVER_STRUCTURES - generators = settings.SERVER_GENERATORS + structures = opts['structures'] + generators = opts['generators'] [data.remove('') for data in [structures, generators] if '' in data] for plugin in structures + generators + ['Metadata']: |