summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Options.py2
-rw-r--r--src/lib/Server/Admin/Client.py5
-rw-r--r--src/lib/Server/Admin/Pull.py4
-rw-r--r--src/lib/Server/Admin/Query.py4
-rw-r--r--src/lib/Server/Core.py16
-rwxr-xr-xsrc/sbin/bcfg2-info11
-rwxr-xr-xsrc/sbin/bcfg2-server6
7 files changed, 28 insertions, 20 deletions
diff --git a/src/lib/Options.py b/src/lib/Options.py
index 3c5b3979a..5d62196aa 100644
--- a/src/lib/Options.py
+++ b/src/lib/Options.py
@@ -179,6 +179,8 @@ SERVER_REPOSITORY = Option('Server repository path', '/var/lib/bcfg2',
cf=('server', 'repository'), cmd='-Q',
odesc='<repository path>' )
SERVER_SVN = Option('Server svn support', False, cf=('server', 'svn'))
+SERVER_PLUGINS = Option('Server plugin list', cf=('server', 'plugins'),
+ default=[], cook=list_split)
SERVER_GENERATORS = Option('Server generator list', cf=('server', 'generators'),
default=['SSHbase', 'Cfg', 'Pkgmgr', 'Rules'],
cook=list_split)
diff --git a/src/lib/Server/Admin/Client.py b/src/lib/Server/Admin/Client.py
index a63c971fe..c51ac1598 100644
--- a/src/lib/Server/Admin/Client.py
+++ b/src/lib/Server/Admin/Client.py
@@ -8,9 +8,8 @@ class Client(Bcfg2.Server.Admin.Mode):
def __init__(self, configfile):
Bcfg2.Server.Admin.Mode.__init__(self, configfile)
try:
- self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(),
- [], ['Metadata'],
- 'foo', False, 'UTF-8')
+ self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(), [],
+ [], [], 'foo', False, 'UTF-8')
except Bcfg2.Server.Core.CoreInitError, msg:
self.errExit("Core load failed because %s" % msg)
[self.bcore.fam.Service() for _ in range(5)]
diff --git a/src/lib/Server/Admin/Pull.py b/src/lib/Server/Admin/Pull.py
index 71bfdefc2..d0efe489e 100644
--- a/src/lib/Server/Admin/Pull.py
+++ b/src/lib/Server/Admin/Pull.py
@@ -97,8 +97,8 @@ class Pull(Bcfg2.Server.Admin.Mode):
new_entry = self.BuildNewEntry(client, etype, ename)
try:
- bcore = Bcfg2.Server.Core.Core(self.repo, [], ['Cfg', 'SSHbase', 'Metadata'],
- 'foo', False)
+ bcore = Bcfg2.Server.Core.Core(self.repo, [], [],
+ ['Cfg', 'SSHbase'], 'foo', False)
except Bcfg2.Server.Core.CoreInitError, msg:
self.errExit("Core load failed because %s" % msg)
[bcore.fam.Service() for _ in range(5)]
diff --git a/src/lib/Server/Admin/Query.py b/src/lib/Server/Admin/Query.py
index 9fc019a88..999bde5c2 100644
--- a/src/lib/Server/Admin/Query.py
+++ b/src/lib/Server/Admin/Query.py
@@ -8,8 +8,8 @@ class Query(Bcfg2.Server.Admin.Mode):
Bcfg2.Logging.setup_logging(100, to_console=False, to_syslog=False)
Bcfg2.Server.Admin.Mode.__init__(self, cfile)
try:
- self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(),
- [], ['Metadata'],
+ self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(), [],
+ [], [],
'foo', False, 'UTF-8')
except Bcfg2.Server.Core.CoreInitError, msg:
self.errExit("Core load failed because %s" % msg)
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py
index d7086aa96..57655cbb4 100644
--- a/src/lib/Server/Core.py
+++ b/src/lib/Server/Core.py
@@ -199,7 +199,7 @@ except ImportError:
class Core(object):
'''The Core object is the container for all Bcfg2 Server logic, and modules'''
- def __init__(self, repo, structures, generators, password, svn, encoding):
+ def __init__(self, repo, plugins, structures, generators, password, svn, encoding):
object.__init__(self)
self.datastore = repo
try:
@@ -224,28 +224,28 @@ class Core(object):
[data.remove('') for data in [structures, generators] if '' in data]
- for plugin in structures + generators:
+ for plugin in structures + generators + plugins:
if not self.plugins.has_key(plugin):
self.init_plugins(plugin)
- plugins = self.plugins.values()
+ chk_plugins = self.plugins.values()
while True:
- plugin = plugins.pop()
+ plugin = chk_plugins.pop()
if isinstance(plugin, Bcfg2.Server.Plugin.MetadataPlugin):
self.metadata = plugin
break
- if not plugins:
+ if not chk_plugins:
self.init_plugins("Metadata")
self.metadata = self.plugins["Metadata"]
break
- plugins = self.plugins.values()
+ chk_plugins = self.plugins.values()
while True:
- plugin = plugins.pop()
+ plugin = chk_plugins.pop()
if isinstance(plugin, Bcfg2.Server.Plugin.StatisticsPlugin):
self.stats = plugin
break
- if not plugins:
+ if not chk_plugins:
self.init_plugins("Statistics")
self.stats = self.plugins["Statistics"]
break
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index df278ed92..aca9895db 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -295,6 +295,7 @@ if __name__ == '__main__':
}
optinfo.update({'repo': Bcfg2.Options.SERVER_REPOSITORY,
'svn': Bcfg2.Options.SERVER_SVN,
+ 'plugins': Bcfg2.Options.SERVER_PLUGINS,
'structures': Bcfg2.Options.SERVER_STRUCTURES,
'generators': Bcfg2.Options.SERVER_GENERATORS,
'password': Bcfg2.Options.SERVER_PASSWORD,
@@ -303,11 +304,13 @@ if __name__ == '__main__':
setup = Bcfg2.Options.OptionParser(optinfo)
setup.parse(sys.argv[1:])
if "-d" in sys.argv:
- loop = infoCore(setup['repo'], setup['structures'], setup['generators'],
- setup['password'], setup['svn'], setup['encoding'], True)
+ loop = infoCore(setup['repo'], setup['plugins'], setup['structures'],
+ setup['generators'], setup['password'], setup['svn'],
+ setup['encoding'], True)
else:
- loop = infoCore(setup['repo'], setup['structures'], setup['generators'],
- setup['password'], setup['svn'], setup['encoding'], False)
+ loop = infoCore(setup['repo'], setup['plugins'], setup['structures'],
+ setup['generators'], setup['password'], setup['svn'],
+ setup['encoding'], False)
if "args" in setup and setup['args']:
loop.onecmd(" ".join(setup['args']))
raise SystemExit(0)
diff --git a/src/sbin/bcfg2-server b/src/sbin/bcfg2-server
index 7ee8abfdd..47f0afa1d 100755
--- a/src/sbin/bcfg2-server
+++ b/src/sbin/bcfg2-server
@@ -40,13 +40,16 @@ class Bcfg2Serv(Bcfg2.Component.Component):
raise SetupError
try:
- self.Core = Core(setup['repo'], setup['structures'],
+ self.Core = Core(setup['repo'], setup['plugins'], setup['structures'],
setup['generators'], setup['password'],
setup['svn'], setup['encoding'])
except CoreInitError, msg:
logger.critical("Fatal error: %s" % (msg))
raise SystemExit, 1
+ if 'DBStats' in self.Core.plugins:
+ self.fork_funcs.append("RecvStats")
+
self.funcs.update({
"AssertProfile" : self.Bcfg2AssertProfile,
"GetConfig" : self.Bcfg2GetConfig,
@@ -195,6 +198,7 @@ if __name__ == '__main__':
OPTINFO.update({'repo': Bcfg2.Options.SERVER_REPOSITORY,
'svn': Bcfg2.Options.SERVER_SVN,
+ 'plugins': Bcfg2.Options.SERVER_PLUGINS,
'structures': Bcfg2.Options.SERVER_STRUCTURES,
'generators': Bcfg2.Options.SERVER_GENERATORS,
'password': Bcfg2.Options.SERVER_PASSWORD})