summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-08-06 19:12:13 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-08-06 19:12:13 +0000
commit42ce77fd3274783e17a4f4b619d052f427d25099 (patch)
tree490d40b94606480ab3807d0eac3421aaa16011a8 /src
parent2e688bca6e9bc0cabc321198cc6e8b46c414227a (diff)
downloadbcfg2-42ce77fd3274783e17a4f4b619d052f427d25099.tar.gz
bcfg2-42ce77fd3274783e17a4f4b619d052f427d25099.tar.bz2
bcfg2-42ce77fd3274783e17a4f4b619d052f427d25099.zip
add infrastructure for structure admin modes
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4861 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Admin/__init__.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/Server/Admin/__init__.py b/src/lib/Server/Admin/__init__.py
index a650f64e6..0db1b922c 100644
--- a/src/lib/Server/Admin/__init__.py
+++ b/src/lib/Server/Admin/__init__.py
@@ -47,6 +47,7 @@ class Mode(object):
return hostent[0]
class MetadataCore(Mode):
+ allowed = ['Metadata', 'BB']
'''Base class for admin-modes that handle metadata'''
def __init__(self, configfile):
Mode.__init__(self, configfile)
@@ -56,11 +57,11 @@ class MetadataCore(Mode):
setup = Bcfg2.Options.OptionParser(options)
setup.parse(sys.argv[1:])
plugins = [plugin for plugin in setup['plugins']
- if plugin in ('BB', 'Metadata')]
+ if plugin in self.allowed]
structures = [structure for structure in setup['structures']
- if structure in ('BB', 'Metadata')]
+ if structure in self.allowed]
generators = [generator for generator in setup['generators']
- if generator in ('BB', 'Metadata')]
+ if generator in self.allowed]
try:
self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(), plugins,
structures, generators, 'foo', False, 'UTF-8')
@@ -71,5 +72,8 @@ class MetadataCore(Mode):
pass
self.metadata = self.bcore.metadata
- def __call__(self, args):
- Bcfg2.Server.Admin.Mode.__call__(self, args)
+class StructureMode(MetadataCore):
+ allowed = ['Statistics', 'DBStats']
+ def __init__(self, configfile):
+ MetadataCore.__init__(self, configfile)
+ self.statistics = self.bcore.stats