summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Server/Core.py20
-rw-r--r--src/lib/Server/Plugins/Metadata.py2
-rwxr-xr-xsrc/sbin/bcfg2-info14
-rwxr-xr-xsrc/sbin/bcfg2-server11
4 files changed, 24 insertions, 23 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py
index 56f4087dd..5b7678cd3 100644
--- a/src/lib/Server/Core.py
+++ b/src/lib/Server/Core.py
@@ -8,8 +8,6 @@ from Bcfg2.Server.Statistics import Statistics
import logging, lxml.etree, os, stat
import Bcfg2.Server.Plugins.Metadata
-import Bcfg2.Options
-
logger = logging.getLogger('Bcfg2.Core')
def ShouldIgnore(event):
@@ -200,18 +198,10 @@ 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):
+ def __init__(self, repo, structures, generators, password, svn):
object.__init__(self)
- opts = Bcfg2.Options.OptionParser(self.options)
- opts.parse([])
- self.datastore = opts['repo']
- self.opts = opts
+ self.datastore = repo
try:
self.fam = monitor()
except IOError:
@@ -222,8 +212,8 @@ class Core(object):
self.cron = {}
self.plugins = {}
self.revision = '-1'
-
- self.svn = opts['svn']
+ self.password = password
+ self.svn = svn
try:
if self.svn:
self.read_svn_revision()
@@ -232,8 +222,6 @@ class Core(object):
self.stats = Statistics("%s/etc/statistics.xml" % (self.datastore))
- structures = opts['structures']
- generators = opts['generators']
[data.remove('') for data in [structures, generators] if '' in data]
for plugin in structures + generators + ['Metadata']:
diff --git a/src/lib/Server/Plugins/Metadata.py b/src/lib/Server/Plugins/Metadata.py
index 9e991251b..d2e7ad7c7 100644
--- a/src/lib/Server/Plugins/Metadata.py
+++ b/src/lib/Server/Plugins/Metadata.py
@@ -67,7 +67,7 @@ class Metadata(Bcfg2.Server.Plugin.Plugin):
self.ptimes = {}
self.pctime = 0
self.extra = {'groups.xml':[], 'clients.xml':[]}
- self.password = core.opts['password']
+ self.password = core.password
def HandleEvent(self, event):
'''Handle update events for data files'''
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index bde7ef868..296027034 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -23,10 +23,10 @@ def printTabular(rows):
print fstring % row
class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core):
- def __init__(self):
+ def __init__(self, repo, struct, gens, passwd, svn):
cmd.Cmd.__init__(self)
try:
- Bcfg2.Server.Core.Core.__init__(self)
+ Bcfg2.Server.Core.Core.__init__(self, repo, struct, gens, passwd, svn)
except Bcfg2.Server.Core.CoreInitError, msg:
print "Core load failed because %s" % msg
raise SystemExit(1)
@@ -260,14 +260,20 @@ Usage: [quit|exit]"""
if __name__ == '__main__':
Bcfg2.Logging.setup_logging('bcfg2-info', to_syslog=False)
-
+ print dir(Bcfg2.Options)
optinfo = {
'configfile': Bcfg2.Options.CFILE,
'help': Bcfg2.Options.HELP,
}
+ optinfo.update({'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})
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[1:])
- loop = infoCore()
+ loop = infoCore(setup['repo'], setup['structures'], setup['generators'],
+ setup['password'], setup['svn'])
loop.plugins['Metadata'].load_probedata()
loop.do_loop()
diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server
index ecb5b357d..489a5766d 100755
--- a/src/sbin/bcfg2-server
+++ b/src/sbin/bcfg2-server
@@ -20,7 +20,7 @@ def critical_error(operation):
raise Fault, (7, "Critical unexpected failure: %s" % (operation))
class SetupError(Exception):
- '''Used when the server can't be setup'''
+ '''Used when the server cant be setup'''
pass
class Bcfg2Serv(Bcfg2.Component.Component):
@@ -39,7 +39,8 @@ class Bcfg2Serv(Bcfg2.Component.Component):
raise SetupError
try:
- self.Core = Core()
+ self.Core = Core(setup['repo'], setup['structures'],
+ setup['generators'], setup['password'], setup['svn'])
except CoreInitError, msg:
logger.critical("Fatal error: %s" % (msg))
raise SystemExit, 1
@@ -185,6 +186,12 @@ if __name__ == '__main__':
'verbose' : Bcfg2.Options.VERBOSE,
}
+ OPTINFO.update({'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})
+
setup = Bcfg2.Options.OptionParser(OPTINFO)
setup.parse(sys.argv[1:])
print setup